Documentation ¶
Index ¶
Constants ¶
View Source
const (
DefaultKey = "models/model"
)
Variables ¶
This section is empty.
Functions ¶
func GenerateAnonymousUser ¶
GetAnonymousUser should generate an anonymous user model for all sessions. This should be an unauthenticated 0 value struct.
func Model ¶
func Model() gin.HandlerFunc
Types ¶
type Post ¶
type Post struct { Id uint64 `json:"id,omitempty"` UserId uint64 `form:"user_id" json:"user_id,omitempty"` Title string `form:"title" json:"title,omitempty"` Context string `form:"context" json:"context,omitempty"` CreatedAt time.Time `gorm:"column:created_time" json:"created_time,omitempty"` UpdatedAt time.Time `gorm:"column:updated_time" json:"updated_time,omitempty"` User User `gorm:"ForeignKey:UserId;AssociationForeignKey:Id" json:"user"` }
type User ¶
type User struct { Id uint64 `json:"id,omitempty"` Nickname string `form:"nickname" json:"nickname,omitempty"` Password string `form:"password" json:"-"` Gender int64 `json:"gender,omitempty"` Birthday time.Time `json:"birthday,omitempty"` CreatedAt time.Time `gorm:"column:created_time" json:"created_time,omitempty"` UpdatedAt time.Time `gorm:"column:updated_time" json:"updated_time,omitempty"` // contains filtered or unexported fields }
func (*User) GetById ¶
GetById will populate a user object from a database model with a matching id.
func (*User) IsAuthenticated ¶
func (*User) Login ¶
func (u *User) Login()
Login will preform any actions that are required to make a user model officially authenticated.
Click to show internal directories.
Click to hide internal directories.