models

package
v0.0.0-...-cd11599 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2020 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Enforcer *casbin.Enforcer = nil

Functions

func BuildWordsListForUser

func BuildWordsListForUser(id int) bool

func CountOfMarkedWords

func CountOfMarkedWords(user *User) int64

func CountOfUserWords

func CountOfUserWords(user *User) int64

func DeletePermission

func DeletePermission(permission *Permission)

func DeleteReply

func DeleteReply(reply *Reply)

func DeleteReplyByTopic

func DeleteReplyByTopic(topic *Topic)

func DeleteReplyByUser

func DeleteReplyByUser(user *User)

func DeleteRole

func DeleteRole(role *Role)

func DeleteRolePermissionByPermissionId

func DeleteRolePermissionByPermissionId(permission_id int)

func DeleteRolePermissionByRoleId

func DeleteRolePermissionByRoleId(role_id int)

func DeleteTopic

func DeleteTopic(topic *Topic)

func DeleteTopicByUser

func DeleteTopicByUser(user *User)

func DeleteUser

func DeleteUser(user *User)

func DeleteUserRolesByUserId

func DeleteUserRolesByUserId(UserID int)

func DeleteWord

func DeleteWord(user *User, wordId int)

func DeleteWordsListForUser

func DeleteWordsListForUser(user *User)

func FindPermissionByUserIdAndPermissionName

func FindPermissionByUserIdAndPermissionName(userId int, name string) bool

func FindRolePermissionByRoleId

func FindRolePermissionByRoleId(role_id int) []orm.Params

func FindUserLastMarkWord

func FindUserLastMarkWord(user *User) (string, bool)

func FindUserRolesByUserId

func FindUserRolesByUserId(UserID int) []orm.Params

func IncrReplyCount

func IncrReplyCount(topic *Topic)

func IncrView

func IncrView(topic *Topic)

func IncrWordMark

func IncrWordMark(UserWord *UserWordsStudy, user *User)

func Init

func Init()

func LoadRawWordsJson

func LoadRawWordsJson(random bool) *[]orm.Params

func LoadUserWordsJson

func LoadUserWordsJson(user *User, random bool) []*const_conf.UserWordsJson

func LoadWordsListForUser

func LoadWordsListForUser(user *User) []*const_conf.RawWord

func NewLog

func NewLog(newLog *UserLogs) int64

func PageTopic

func PageTopic(p int, size int, section *Section) utils.Page

func PageUser

func PageUser(p int, size int) utils.Page

func ReduceReplyCount

func ReduceReplyCount(topic *Topic)

func SavePermission

func SavePermission(permission *Permission) int64

func SaveReply

func SaveReply(reply *Reply) int64

func SaveReplyUpLog

func SaveReplyUpLog(replyUpLog *ReplyUpLog) int64

func SaveRole

func SaveRole(role *Role) int64

func SaveRolePermission

func SaveRolePermission(role_id int, permission_id int)

func SaveTopic

func SaveTopic(topic *Topic) int64

func SaveUser

func SaveUser(user *User) int64

func SaveUserRole

func SaveUserRole(UserID int, RoleID int)

func UpReply

func UpReply(reply *Reply)

func UpdatePermission

func UpdatePermission(permission *Permission) int64

func UpdateRole

func UpdateRole(role *Role)

func UpdateTopic

func UpdateTopic(topic *Topic)

func UpdateUser

func UpdateUser(user *User)

Types

type Common

type Common struct {
	Id           int    `orm:"pk;auto"`
	TheTableName string `orm:"size(256);column(table_name)"`
	ColumnName   string `orm:"size(256);"`
	ValueCode    string `orm:"size(256)"`
	CodeMean     string `orm:"size(256)"`
}

func (*Common) TableName

func (u *Common) TableName() string

func (*Common) UserLogs

func (u *Common) UserLogs() string

func (*Common) UserWordsStudy

func (u *Common) UserWordsStudy() string

func (*Common) WordsList

func (u *Common) WordsList() string

type Permission

type Permission struct {
	Id               int `orm:"pk;auto"`
	Pid              int
	Url              string
	Name             string
	Description      string
	Roles            []*Role       `orm:"reverse(many)"`
	ChildPermissions []*Permission `orm:"-"`
}

func FindPermissionById

func FindPermissionById(id int) Permission

func FindPermissions

func FindPermissions() []*Permission

func FindPermissionsByPid

func FindPermissionsByPid(pid int) []*Permission

type Reply

type Reply struct {
	Id      int       `orm:"pk;auto"`
	Topic   *Topic    `orm:"rel(fk)"`
	Content string    `orm:"type(text)"`
	User    *User     `orm:"rel(fk)"`
	Up      int       `orm:"default(0)"`
	InTime  time.Time `orm:"auto_now_add;type(datetime)"`
}

func FindReplyById

func FindReplyById(id int) Reply

func FindReplyByTopic

func FindReplyByTopic(topic *Topic) []*Reply

func FindReplyByUser

func FindReplyByUser(user *User, limit int) []*Reply

type ReplyUpLog

type ReplyUpLog struct {
	Id     int       `orm:"pk;auto"`
	User   *User     `orm:"rel(fk)"`
	Reply  *Reply    `orm:"rel(fk)"`
	InTime time.Time `orm:"auto_now_add;type(datetime)"`
}

func FindReplyUpLogByUserAndReply

func FindReplyUpLogByUserAndReply(user *User, reply *Reply) ReplyUpLog

type Role

type Role struct {
	Id          int           `orm:"pk;auto"`
	Name        string        `orm:"unique"`
	Users       []*User       `orm:"reverse(many)"`
	Permissions []*Permission `orm:"rel(m2m)"`
}

func FindRoleById

func FindRoleById(id int) Role

func FindRoles

func FindRoles() []*Role

type RolePermissions

type RolePermissions struct {
	// contains filtered or unexported fields
}

type Section

type Section struct {
	Id   int    `orm:"pk;auto"`
	Name string `orm:"unique"`
}

func FindAllSection

func FindAllSection() []*Section

type Topic

type Topic struct {
	Id            int       `orm:"pk;auto"`
	Title         string    `orm:"unique"`
	Content       string    `orm:"type(text);null"`
	InTime        time.Time `orm:"auto_now_add;type(datetime)"`
	User          *User     `orm:"rel(fk)"`
	Section       *Section  `orm:"rel(fk)"`
	View          int       `orm:"default(0)"`
	ReplyCount    int       `orm:"default(0)"`
	LastReplyUser *User     `orm:"rel(fk);null"`
	LastReplyTime time.Time `orm:"auto_now_add;type(datetime)"`
}

func FindTopicById

func FindTopicById(id int) Topic

func FindTopicByUser

func FindTopicByUser(user *User, limit int) []*Topic

type User

type User struct {
	Id        int    `orm:"pk;auto;index"`
	Username  string `orm:"unique;index"`
	Password  string
	Token     string `orm:"unique;index"`
	Avatar    string
	Email     string      `orm:"null"`
	Url       string      `orm:"null"`
	Signature string      `orm:"null;size(1000)"`
	Operation []*UserLogs `orm:"reverse(many)"`
	InTime    time.Time   `orm:"auto_now_add;type(datetime)"`
	Roles     []*Role     `orm:"rel(m2m)"`
}

func FindUserById

func FindUserById(id int) (bool, User)

func FindUserByToken

func FindUserByToken(token string) (bool, User)

func FindUserByUserName

func FindUserByUserName(username string) (bool, User)

func Login

func Login(username string, password string) (bool, User)

type UserLogs

type UserLogs struct {
	Id      int    `orm:"pk;auto"`
	User    *User  `orm:"rel(fk);index"`
	Content string `orm:"type(text);index"`
}

type UserWordsStudy

type UserWordsStudy struct {
	Id         int        `orm:"pk;auto;index"`
	UserId     int        `orm:"index"`
	Word       *WordsList `orm:"rel(fk)"`
	CountMarks int        `orm:"default(0);index"`
	LastMark   time.Time  `orm:"auto_now;type(datetime);null"`
}

func FindUserWordByWordId

func FindUserWordByWordId(user *User, wordId int) (*UserWordsStudy, bool)

type WordsList

type WordsList struct {
	Id            int               `orm:"pk;auto;index"`
	Word          string            `orm:"size(64);index"`
	Means         string            `orm:"size(512);"`
	LinkUserStudy []*UserWordsStudy `orm:"reverse(many)"`
}

func FindWordById

func FindWordById(id int) *WordsList

func LoadRawWords

func LoadRawWords() []*WordsList

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL