account.go 435 Bytes
package models

import (
	"pro2d/pb"
)

type AccountModel struct {
	*Schema
	*pb.Account
}

func AccountExistByPhone(phone string) (bool, *AccountModel){
	m := NewAccount(phone)
	if err := m.Load(); err != nil {
		return false, m
	}
	return true, m
}

func NewAccount(phone string) *AccountModel {
	ac := &pb.Account{
		Phone: phone,

	}

	account := &AccountModel{
		Schema:  NewSchema(phone, ac),
		Account: ac,
	}

	return account
}