Documentation ¶
Overview ¶
An open source project for personal blog website
An open source project for personal blog website ¶
An open source project for personal blog website ¶
An open source project for personal blog website ¶
An open source project for personal blog website ¶
An open source project for personal blog website
Index ¶
- Constants
- Variables
- func GetSession() *xorm.Session
- func InitDatabase() error
- type Album
- type Category
- type Pager
- type Photo
- type Topic
- type User
- func (u *User) AllUserCount() (int64, error)
- func (u *User) Delete() error
- func (u *User) DisableUserCount() (int64, error)
- func (u *User) GetUserByEmail(email string) error
- func (u *User) GetUserById(id int64) error
- func (u *User) GetUserByUsername(username string) error
- func (u *User) GetUsers(offset int, size int) ([]*User, error)
- func (u *User) IsUserExist() (bool, error)
- func (u *User) SaveUser() error
- func (u *User) String() string
- func (u *User) UpdateUser() error
Constants ¶
View Source
const ( MIN_PAGE_SIZE = 10 // 最小分页 MAX_PAGE_SIZE = 100 // 最大分页 )
Variables ¶
View Source
var ( ErrCategoryNotExist = errors.New("Category does not exist") ErrCategoryAlreadExist = errors.New("Category alread exist") ErrCategoryIsNull = errors.New("Category is null") )
View Source
var ( ErrTopicNotExist = errors.New("Topic does not exist") ErrTopicIsNull = errors.New("Topic is null") )
View Source
var ( ErrUserNotExist = errors.New("User does not exist") ErrUserAlreadExist = errors.New("User alread exist") ErrUserIsNull = errors.New("User is null") )
View Source
var (
ErrParameter = errors.New("Parameter is wrong")
)
Functions ¶
func GetSession ¶
func InitDatabase ¶
func InitDatabase() error
Types ¶
type Album ¶
type Album struct { Id int64 Name string `xorm:"size(100)"` Cover string `xorm:"size(70)"` Posttime time.Time `xorm:"type(datetime);index"` Ishide int8 Rank int8 Photonum int64 }
相册表
type Category ¶
type Pager ¶
type Photo ¶
type Photo struct { Id int64 `xorm:int` Albumid int64 `xorm:int` Des string `xorm:varchar(100)` Posttime time.Time `xorm:"DateTime created"` Url string `xorm:"varchar(70)"` Small string `xorm:"-"` }
相册表
type Topic ¶
type Topic struct { Id int64 `xorm:"pk autoincr"` Title string `xorm:"varchar(255) notnull"` // 标题 TitleColor string `xorm:varchar(7)` // 标题置顶颜色 PreContent string `xorm:"varchar(255)"` // 预读内容 Content string `xorm:"text"` // 内容 Tags string `xorm:"varchar(255)"` // 标签:多个标签使用|分隔 CategorieId int64 `xorm:index` // 分类ID Categorie *Category `xorm:"- <- ->"` // 分类 AuthorId int64 `xorm:index` // 作者ID Author *User `xorm:"- <- ->"` // 作者 Status int8 `xorm:int` // 发布状态 IsTop int8 `xorm:int` // 是否致顶 Cover string `xorm:varchar(100)` // 封面图片 Views int64 `xorm:int` // 阅读数 SourceFrom string `xorm:"varchar(255)"` // 信息来源 CreateTime time.Time `xorm:"DateTime created"` // 创建时间 UpdateTime time.Time `xorm:"DateTime updated"` // 更新时间 }
type User ¶
type User struct { Id int64 `xorm:"pk autoincr"` Name string `xorm:varchar(100)` // `姓名` Email string `xorm:varchar(100)` // `邮箱地址` Username string `xorm:varchar(100) notnull` // `用户名称` Password string `xorm:varchar(100) notnull` // `用户密码` LoginCount int64 `xorm:int` // 登录次数 Authkey string `xorm:varchar(10)"` Active int8 `xorm:int` // 是否激活 CreateTime time.Time `xorm:"DateTime created"` // `创建时间` LastLoginTime time.Time `xorm:"DateTime updated"` // `最后登录时间` LoginIp string `xorm:"varchar(100)"` // `登录IP` }
func (*User) AllUserCount ¶
func (*User) DisableUserCount ¶
func (*User) GetUserByEmail ¶
Find user with e-mail address
func (*User) GetUserByUsername ¶
Find user with username
func (*User) IsUserExist ¶
Check user whether or not exist in db with the username
Source Files ¶
Click to show internal directories.
Click to hide internal directories.