Documentation ¶
Index ¶
- func Cache(db *gorm.DB) *orm.CacheDB
- func CacheStore() cache.CacheStore
- func DB() *gorm.DB
- func GenerateAnonymousUser() auth.User
- type Post
- type User
- func (u *User) AddUserWithNicknamePwd(nickname string, pwd string) *User
- func (u *User) GetById(id interface{}) error
- func (u *User) GetUserById(id uint64) *User
- func (u *User) GetUserByNicknamePwd(nickname string, pwd string) *User
- func (u *User) IsAuthenticated() bool
- func (u *User) Login()
- func (u *User) Logout()
- func (u User) TableName() string
- func (u *User) TraceGetUserById(id uint64) *User
- func (u *User) UniqueId() interface{}
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CacheStore ¶
func CacheStore() cache.CacheStore
func GenerateAnonymousUser ¶
GetAnonymousUser should generate an anonymous user model for all sessions. This should be an unauthenticated 0 value struct.
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"` }
func (*Post) GetPostById ¶
func (*Post) GetUserPostsByUserId ¶
type User ¶
type User struct { orm.Model `gorm:"-"` 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) AddUserWithNicknamePwd ¶
func (*User) GetById ¶
GetById will populate a user object from a database model with a matching id.
func (*User) GetUserById ¶
func (*User) GetUserByNicknamePwd ¶
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.
func (*User) Logout ¶
func (u *User) Logout()
Logout will preform any actions that are required to completely logout a user.
func (*User) TraceGetUserById ¶
Click to show internal directories.
Click to hide internal directories.