Documentation ¶
Index ¶
- func AuthenticateUser(ctx context.Context, db *gorm.DB) bool
- func AuthorizeUser(ctx context.Context, db *gorm.DB, fn AuthorizationFunction) bool
- func HashPassword(password string) (string, error)
- func Migrate(db *gorm.DB) error
- func NewDatabase() (*gorm.DB, error)
- type AuthorizationFunction
- type User
- type UserIn
- type UserOut
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AuthorizeUser ¶
func HashPassword ¶
func NewDatabase ¶
Types ¶
type AuthorizationFunction ¶
type User ¶
type User struct { gorm.Model ID uint `gorm:"primaryKey;autoIncrement" json:"id,omitempty"` Username string `gorm:"not null;unique" json:"username"` Fullname string `gorm:"not null" json:"fullname"` Email string `gorm:"not null;unique" json:"email"` Password string `gorm:"not null" json:"password"` IsAdmin bool `gorm:"default:false" json:"isAdmin"` CreatedAt time.Time `gorm:"autoCreateTime" json:"createdAt,omitempty"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updatedAt,omitempty"` }
type UserOut ¶
type UserOut struct { ID uint `json:"id"` Username string `json:"username"` Fullname string `json:"fullname"` Email string `json:"email"` IsAdmin bool `json:"isAdmin"` CreatedAt time.Time `json:"createdAt,omitempty"` UpdatedAt time.Time `json:"updatedAt,omitempty"` }
func UserArrayOut ¶
Click to show internal directories.
Click to hide internal directories.