Documentation
¶
Index ¶
- Constants
- Variables
- func ValidateEmail(v *validator.Validator, email string)
- func ValidatePassword(v *validator.Validator, plaintext string)
- func ValidateTokenPlaintext(v *validator.Validator, plaintext string)
- func ValidateUser(v *validator.Validator, user *User)
- type Expense
- type ExpenseModel
- type Filters
- type Models
- type Token
- type TokenModel
- type User
- type UserModel
Constants ¶
View Source
const ( ScopeActivation = "activation" ScopeAuthentication = "authentication" )
Variables ¶
View Source
var ( ErrRecordNotFound = errors.New("record not found") ErrEditConflict = errors.New("edit conflict") )
View Source
var AnonymousUser = &User{}
View Source
var (
ErrDuplicateEmail = errors.New("duplicate email")
)
Functions ¶
func ValidateEmail ¶
func ValidatePassword ¶
func ValidateTokenPlaintext ¶
func ValidateUser ¶
Types ¶
type ExpenseModel ¶
func (ExpenseModel) Insert ¶
func (m ExpenseModel) Insert(expense *Expense) error
type Models ¶
type Models struct { Users interface { Insert(user *User) error GetByEmail(email string) (*User, error) Update(user *User) error GetForToken(scope string, plaintext string) (*User, error) } Tokens interface { New(userID int64, ttl time.Duration, scope string) (*Token, error) Insert(token *Token) error DeleteAllForUser(scope string, userID int64) error } }
type TokenModel ¶
func (TokenModel) DeleteAllForUser ¶
func (m TokenModel) DeleteAllForUser(scope string, userID int64) error
func (TokenModel) Insert ¶
func (m TokenModel) Insert(token *Token) error
type User ¶
type User struct { ID int64 `json:"id"` Name string `json:"name"` Email string `json:"email"` Password password `json:"-"` Version int `json:"-"` Activated bool `json:"activated"` CreatedAt time.Time `json:"created_at"` }
func (*User) IsAnonymous ¶
type UserModel ¶
func (UserModel) GetForToken ¶
Click to show internal directories.
Click to hide internal directories.