Documentation ¶
Index ¶
- Constants
- Variables
- func ValidateEmail(v *validator.Validator, email string)
- func ValidateFilters(v *validator.Validator, f Filters)
- func ValidateMovie(v *validator.Validator, movie *Movie)
- func ValidatePasswordPlaintext(v *validator.Validator, password string)
- func ValidateTokenPlaintext(v *validator.Validator, tokenPlaintext string)
- func ValidateUser(v *validator.Validator, user *User)
- type Filters
- type Metadata
- type Models
- type Movie
- type MovieModel
- func (m MovieModel) Delete(ctx context.Context, id int64) error
- func (m MovieModel) Get(ctx context.Context, id int64) (*Movie, error)
- func (m MovieModel) GetAll(ctx context.Context, title string, genres []string, filters Filters) ([]*Movie, Metadata, error)
- func (m MovieModel) Insert(ctx context.Context, movie *Movie) error
- func (m MovieModel) Update(ctx context.Context, movie *Movie) error
- type PermissionModel
- type Permissions
- type Runtime
- type Token
- type TokenModel
- type User
- type UserModel
- func (m UserModel) GetByEmail(ctx context.Context, email string) (*User, error)
- func (m UserModel) GetForToken(ctx context.Context, tokenScope, tokenPlaintext string) (*User, error)
- func (m UserModel) Insert(ctx context.Context, user *User) error
- func (m UserModel) Update(ctx context.Context, user *User) error
Constants ¶
View Source
const ( ScopeActivation = "activation" ScopeAuthentication = "authentication" )
Variables ¶
View Source
var ( ErrRecordNotFound = errors.New("record not found") ErrEditConflict = errors.New("edit conflict") ErrDuplicateEmail = errors.New("duplicate email") )
View Source
var AnonymousUser = &User{}
View Source
var ErrInvalidRuntimeFormat = fmt.Errorf("invalid runtime format")
Functions ¶
func ValidateEmail ¶
func ValidateFilters ¶
func ValidateMovie ¶
func ValidateTokenPlaintext ¶
func ValidateUser ¶
Types ¶
type Models ¶
type Models struct { Movies MovieModel Permissions PermissionModel Tokens TokenModel Users UserModel }
type MovieModel ¶
type PermissionModel ¶
func (PermissionModel) AddForUser ¶
func (PermissionModel) GetAllForUser ¶
func (m PermissionModel) GetAllForUser(ctx context.Context, userID int64) (Permissions, error)
type Permissions ¶
type Permissions []string
func (Permissions) Include ¶
func (p Permissions) Include(code string) bool
type TokenModel ¶
func (TokenModel) DeleteAllForUser ¶
type User ¶
type User struct { ID int64 `json:"id"` CreatedAt time.Time `json:"created_at"` Name string `json:"name"` Email string `json:"email"` Password password `json:"-"` Activated bool `json:"activated"` Version int `json:"-"` }
func (*User) IsAnonymous ¶
Click to show internal directories.
Click to hide internal directories.