Documentation ¶
Overview ¶
Copyright 2014 Jiang Le
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2014 Jiang Le ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func Follows() orm.QuerySeter
- func Users() orm.QuerySeter
- type Category
- type Comment
- type Content
- type Follow
- type Topic
- type User
- func (m *User) AvatarUrl() (url string)
- func (m *User) ConsumeActivateCode(code string) error
- func (m *User) Delete() error
- func (u *User) Follow(who *User) (err error)
- func (m *User) FollowerUsers() orm.QuerySeter
- func (m *User) FollowingUsers() orm.QuerySeter
- func (m *User) GenerateActivateCode() (code string, err error)
- func (m *User) Insert() error
- func (m *User) LargeAvatarUrl() (url string)
- func (m *User) LatestComments(count int) []*Comment
- func (m *User) LatestTopics(count int) []*Topic
- func (m *User) Read(fields ...string) error
- func (m *User) SetPassword(password string) error
- func (u *User) TableEngine() string
- func (m *User) TestActivateCode(code string) bool
- func (u *User) UnFollow(who *User) (err error)
- func (m *User) Update(fields ...string) error
- func (m *User) ValidUsername() (err error)
- func (m *User) ValidateAndSetAvatar(avatarFile io.Reader, filename string) error
- func (m *User) ValidateUrl() (err error)
- func (m *User) VerifyActivateCode(code string) bool
- func (m *User) VerifyPassword(password string) bool
Constants ¶
const (
UsernameRegex = `^[\p{Han}a-zA-Z0-9]+$`
)
Variables ¶
This section is empty.
Functions ¶
func Follows ¶
func Follows() orm.QuerySeter
func Users ¶
func Users() orm.QuerySeter
Types ¶
type Category ¶
type Category struct { Id int ParentCategory *Category `orm:"null;rel(fk);on_delete(set_null);index"` Depth int `orm:"index"` Sort int `orm:"index"` UrlCode string `orm:"size(30)";unique` Name string `orm:"size(50)"` Description string `orm:"type(text)"` Rules string `orm:"type(text)"` TopicCount int `orm:"index"` CommentCount int `orm:"index"` IsReadOnly bool `orm:"index"` IsModOnly bool `orm:"index"` IsHidden bool `orm:"index"` LastReplyUsername string `orm:"size(30)"` LastReplyComment *Comment `orm:"rel(fk)"` LastReplyTopicTitle string `orm:"size(255)"` LastReplyAt time.Time `orm:""` }
话题分类
func (*Category) TableEngine ¶
type Comment ¶
type Comment struct { Id int Topic *Topic `orm:"rel(fk);index"` ContentHex string `orm:"size(24)"` Content *Content `orm:"-"` User *User `orm:"rel(fk);index"` Username string `orm:"size(30)` Ip string `orm:"size(39)"` Created time.Time `orm:"auto_now_add";index` Updated time.Time `orm:"auto_now"` }
留言/回帖
func (*Comment) SyncContent ¶
func (*Comment) TableEngine ¶
type Content ¶
type Follow ¶
type Follow struct { Id int User *User `orm:"rel(fk)"` Username string `orm:"size(30)` FollowUser *User `orm:"rel(fk)"` FollowUsername string `orm:"size(30)` Mutual bool Created time.Time `orm:"auto_now_add;index"` }
func (*Follow) TableEngine ¶
func (*Follow) TableUnique ¶
type Topic ¶
type Topic struct { Id int Title string `orm:"size(255)"` ContentHex string `orm:"size(24)"` //mongodb对象编号 Content *Content `orm:"-"` User *User `orm:"rel(fk);index"` Username string `orm:"size(30)` Category *Category `orm:"rel(fk);index"` PvCount int `orm:"index"` CommentCount int `orm:"index"` BookmarkCount int `orm:"index"` IsExcellent bool `orm:"index"` IsClosed bool `orm:""` LastReplyUsername string `orm:"size(30)` LastReplyAt time.Time `orm:""` Created time.Time `orm:"auto_now_add"` Updated time.Time `orm:"auto_now"` Ip string `orm:"size(39)"` }
话题/帖子
func (*Topic) TableEngine ¶
type User ¶
type User struct { Id int Username string `orm:"size(30);unique"` Nickname string `orm:"size(30)"` Password string `orm:"size(128)"` Url string `orm:"size(100)"` Company string `orm:"size(30)"` Location string `orm:"size(30)"` Email string `orm:"size(80);unique"` Avatar string `orm:"size(32)"` Info string `` Weibo string `orm:"size(30)"` WeChat string `orm:"size(20)"` Qq string `orm:"size(20)"` PublicEmail bool `` Followers int `` Following int `` FavTopics int `` Topics int Comments int Reputation int Credits int ExcellentTopics int IsAdmin bool `orm:"index"` IsActive bool `orm:"index"` IsBanned bool `orm:"index"` Salt string `orm:"size(6)"` Created time.Time `orm:"auto_now_add;index"` Updated time.Time `orm:"auto_now"` }
func (*User) FollowerUsers ¶
func (m *User) FollowerUsers() orm.QuerySeter
func (*User) FollowingUsers ¶
func (m *User) FollowingUsers() orm.QuerySeter
func (*User) GenerateActivateCode ¶
func (*User) LargeAvatarUrl ¶
func (*User) LatestComments ¶
func (*User) LatestTopics ¶
func (*User) SetPassword ¶
func (*User) TableEngine ¶
func (*User) ValidUsername ¶
func (*User) ValidateAndSetAvatar ¶
func (*User) ValidateUrl ¶
func (*User) VerifyActivateCode ¶
验证激活码 如果验证通过User对象会变成激活码对应的User