Documentation
¶
Index ¶
- func GenerateRandomBytes(n int) ([]byte, error)
- type Database
- func (c *Database) CreateUser(user *api.User) (*api.User, error)
- func (c *Database) DeleteUser(id int64, hardDelete bool) error
- func (c *Database) GetUserByID(id int64) (*api.User, error)
- func (c *Database) GetUserByUsername(username string) (*api.User, error)
- func (c *Database) ListUsers(filters *ListFilters) ([]*api.User, error)
- func (c *Database) UpdateUser(id int64, newData *api.User) error
- type ListFilters
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Database ¶
func (*Database) GetUserByUsername ¶
type ListFilters ¶
type User ¶
type User struct {
ID int64 `gorm:"primarykey;<-:create"`
CreatedAt time.Time `gorm:"<-:create"`
UpdatedAt time.Time
DeletedAt gorm.DeletedAt `gorm:"index"`
PasswordHash []byte
// TODO: salt must become readonly
Salt []byte
Username string `gorm:"unique;size:100"`
DisplayName string `gorm:"size:100"`
Email string `gorm:"unique;size:300"`
RegistrationIP string `gorm:"size:50;<-:create"`
Bio sql.NullString `gorm:"unique;size:500"`
Birthday sql.NullTime `json:"birthday,omitempty" yaml:"birthday,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.