Documentation
¶
Index ¶
- Variables
- func CreateUser(ctx context.Context, u *User) (int64, error)
- func DeleteUser(ctx context.Context, u *User) error
- func UpdateUser(ctx context.Context, u *User) error
- type DBQuerier
- type DBTX
- type Password
- type Querier
- type User
- func (u *User) Delete(ctx context.Context) error
- func (u *User) FieldDefs() attrs.Definitions
- func (u *User) IsAdmin() bool
- func (u *User) IsAuthenticated() bool
- func (u *User) Reload(ctx context.Context) error
- func (u *User) Save(ctx context.Context) error
- func (u *User) String() string
- func (u *User) Update(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
View Source
var BackendForDB = backend.BackendForDB
View Source
var Register = backend.RegisterForDriver
Functions ¶
Types ¶
type DBQuerier ¶
type Querier ¶
type Querier interface {
Count(ctx context.Context) (int64, error)
CountMany(ctx context.Context, isActive bool, isAdministrator bool) (int64, error)
CreateUser(ctx context.Context, email string, username string, password string, firstName string, lastName string, isAdministrator bool, isActive bool) (int64, error)
DeleteUser(ctx context.Context, id uint64) error
Retrieve(ctx context.Context, limit int32, offset int32) ([]*User, error)
RetrieveByEmail(ctx context.Context, email string) (*User, error)
RetrieveByID(ctx context.Context, id uint64) (*User, error)
RetrieveByUsername(ctx context.Context, username string) (*User, error)
RetrieveMany(ctx context.Context, isActive bool, isAdministrator bool, limit int32, offset int32) ([]*User, error)
UpdateUser(ctx context.Context, email string, username string, password string, firstName string, lastName string, isAdministrator bool, isActive bool, iD uint64) error
WithTx(tx *sql.Tx) Querier
Close() error
}
type User ¶
type User struct {
ID uint64 `json:"id" attrs:"primary;readonly"`
CreatedAt time.Time `json:"created_at" attrs:"readonly"`
UpdatedAt time.Time `json:"updated_at" attrs:"readonly"`
Email *models.Email `json:"email"`
Username string `json:"username"`
Password Password `json:"password"`
FirstName string `json:"first_name"`
LastName string `json:"last_name"`
IsAdministrator bool `json:"is_administrator" attrs:"blank;default=true"`
IsActive bool `json:"is_active" attrs:"blank;default=true"`
IsLoggedIn bool `json:"is_logged_in"`
}
func (*User) FieldDefs ¶
func (u *User) FieldDefs() attrs.Definitions
func (*User) IsAuthenticated ¶
Click to show internal directories.
Click to hide internal directories.