models

package
v0.0.0-...-a038544 Latest Latest
Warning

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

Go to latest
Published: Oct 10, 2020 License: GPL-3.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Appends

func Appends() orm.QuerySeter

func Articles

func Articles() orm.QuerySeter

func Categories

func Categories() orm.QuerySeter

func CheckIsExist

func CheckIsExist(qs orm.QuerySeter, field string, value interface{}, skipId int) bool

func Comments

func Comments() orm.QuerySeter

func CountObjects

func CountObjects(qs orm.QuerySeter) (int64, error)

func FollowTopics

func FollowTopics() orm.QuerySeter

func Follows

func Follows() orm.QuerySeter

func GetUserSalt

func GetUserSalt() string

return a user salt token

func ListObjects

func ListObjects(qs orm.QuerySeter, objs interface{}) (int64, error)

func Posts

func Posts() orm.QuerySeter

func Topics

func Topics() orm.QuerySeter

func Users

func Users() orm.QuerySeter

Types

type AppendPost

type AppendPost struct {
	Id           int
	Post         *Post     `orm:"rel(fk)"`
	Message      string    `orm:"type(text)"`
	MessageCache string    `orm:"type(text)"`
	Created      time.Time `orm:"auto_now_add;index"`
}

append content for post

func (*AppendPost) Delete

func (m *AppendPost) Delete() error

func (*AppendPost) GetMessageCache

func (m *AppendPost) GetMessageCache() string

func (*AppendPost) Insert

func (m *AppendPost) Insert() error

func (*AppendPost) Read

func (m *AppendPost) Read(fields ...string) error

func (*AppendPost) String

func (m *AppendPost) String() string

func (*AppendPost) Update

func (m *AppendPost) Update(fields ...string) error

type Article

type Article struct {
	Id               int
	User             *User     `orm:"rel(fk)"`
	Uri              string    `orm:"size(60);unqiue"`
	Title            string    `orm:"size(60)"`
	Content          string    `orm:"type(text)"`
	ContentCache     string    `orm:"type(text)"`
	TitleZhCn        string    `orm:"size(60)"`
	ContentZhCn      string    `orm:"type(text)"`
	ContentCacheZhCn string    `orm:"type(text)"`
	LastAuthor       *User     `orm:"rel(fk);null"`
	IsPublish        bool      `orm:"index"`
	Created          time.Time `orm:"auto_now_add"`
	Updated          time.Time `orm:"auto_now"`
}

func (*Article) Delete

func (m *Article) Delete() error

func (*Article) GetContentCache

func (m *Article) GetContentCache(lang string) string

func (*Article) GetTitle

func (m *Article) GetTitle(lang string) string

func (*Article) Insert

func (m *Article) Insert() error
func (m *Article) Link() string

func (*Article) Read

func (m *Article) Read(fields ...string) error

func (*Article) String

func (m *Article) String() string

func (*Article) Update

func (m *Article) Update(fields ...string) error

type Assistant

type Assistant struct {
	Ranking string
	Name    string
	Team    string
	Teamid  string `json:",omitempty"`
	Assists string
}

type AssistantElement

type AssistantElement struct {
	Id               string
	Name             string
	Playerassistrank []Assistant
}

type Card

type Card struct {
	Name            string
	Team            string
	Teamid          string `json:",omitempty"`
	YellowCardCount string
	RedCardCount    string
}

type CardrankElement

type CardrankElement struct {
	Id        string
	Name      string
	Standings []Card
}

type Category

type Category struct {
	Id    int
	Name  string `orm:"size(30);unique"`
	Slug  string `orm:"size(100);unique"`
	Order int    `orm:"index"`
}

topic category

func (*Category) Delete

func (m *Category) Delete() error

func (*Category) Insert

func (m *Category) Insert() error
func (m *Category) Link() string

func (*Category) Read

func (m *Category) Read(fields ...string) error

func (*Category) String

func (m *Category) String() string

func (*Category) Update

func (m *Category) Update(fields ...string) error

type Comment

type Comment struct {
	Id           int
	User         *User  `orm:"rel(fk)"`
	Post         *Post  `orm:"rel(fk)"`
	Message      string `orm:"type(text)"`
	MessageCache string `orm:"type(text)"`
	Floor        int
	Status       int
	Duplicated   bool      `orm:"index"`
	Created      time.Time `orm:"auto_now_add;index"`
}

comment content for post

func (*Comment) Delete

func (m *Comment) Delete() error

func (*Comment) GetMessageCache

func (m *Comment) GetMessageCache() string

func (*Comment) Insert

func (m *Comment) Insert() error

func (*Comment) Read

func (m *Comment) Read(fields ...string) error

func (*Comment) String

func (m *Comment) String() string

func (*Comment) Update

func (m *Comment) Update(fields ...string) error

type FavoritePost

type FavoritePost struct {
	Id      int
	User    *User     `orm:"rel(fk)"`
	Post    *Post     `orm:"rel(fk)"`
	Created time.Time `orm:"auto_now_add"`
}

user favorite posts

func (*FavoritePost) TableUnique

func (*FavoritePost) TableUnique() [][]string

type Follow

type Follow struct {
	Id         int
	User       *User `orm:"rel(fk)"`
	FollowUser *User `orm:"rel(fk)"`
	Mutual     bool
	Created    time.Time `orm:"auto_now_add"`
}

user follow

func (*Follow) Delete

func (m *Follow) Delete() error

func (*Follow) Insert

func (m *Follow) Insert() error

func (*Follow) Read

func (m *Follow) Read(fields ...string) error

func (*Follow) TableUnique

func (*Follow) TableUnique() [][]string

func (*Follow) Update

func (m *Follow) Update(fields ...string) error

type FollowTopic

type FollowTopic struct {
	Id      int
	User    *User     `orm:"rel(fk)"`
	Topic   *Topic    `orm:"rel(fk)"`
	Created time.Time `orm:"auto_now_add"`
}

user follow topics

func (*FollowTopic) Delete

func (m *FollowTopic) Delete() error

func (*FollowTopic) Insert

func (m *FollowTopic) Insert() error

func (*FollowTopic) Read

func (m *FollowTopic) Read(fields ...string) error

func (*FollowTopic) String

func (m *FollowTopic) String() string

func (*FollowTopic) TableUnique

func (*FollowTopic) TableUnique() [][]string

func (*FollowTopic) Update

func (m *FollowTopic) Update(fields ...string) error

type FootballScore

type FootballScore struct {
	Standings  []StandingElement
	Playerrank []PlayerrankElement
	Assistrank []AssistantElement
	Cardrank   []CardrankElement
}

type HeartwaterDaxiao

type HeartwaterDaxiao struct {
	HandicapShow string
	Da           float32
	Xiao         float32
	Handicap     string
}

type HeartwaterOp

type HeartwaterOp struct {
	Home  float32
	Guest float32
	Drawn float32
}

type HeartwaterRecord

type HeartwaterRecord struct {
	VsString    string
	Turn        string
	Op          HeartwaterOp
	Gy          string
	Status      json.Number
	CatchStat   string
	HometeamID  string
	GameId      json.Number
	State       json.Number
	Daxiao      []HeartwaterDaxiao
	League      string
	Living      string
	Bgcolor     string
	Id          json.Number
	StartTime   string
	LeagueId    string
	GuestteamID string
	HomeTeam    template.HTML
	Yazhi       []HeartwaterYazhi
	GuestTeam   template.HTML
}

type HeartwaterYazhi

type HeartwaterYazhi struct {
	HomeHandcip  float32
	HandicapShow string
	GuestHandcip float32
	Handicap     string
}

type Image

type Image struct {
	Id      int
	User    *User `orm:"rel(fk)"`
	Width   int
	Height  int
	Ext     int `orm:"index"`
	Created time.Time
}

func (*Image) DecodeToken

func (m *Image) DecodeToken(token string) error

func (*Image) Delete

func (m *Image) Delete() error

func (*Image) GetExt

func (m *Image) GetExt() string

func (*Image) GetToken

func (m *Image) GetToken() string

func (*Image) Insert

func (m *Image) Insert() error

func (*Image) LinkFull

func (m *Image) LinkFull() string

func (*Image) LinkMiddle

func (m *Image) LinkMiddle() string

func (*Image) LinkSize

func (m *Image) LinkSize(width int) string

func (*Image) LinkSmall

func (m *Image) LinkSmall() string

func (*Image) Read

func (m *Image) Read(fields ...string) error

func (*Image) Update

func (m *Image) Update(fields ...string) error

type PlayerRank

type PlayerRank struct {
	Ranking  string
	Name     string
	Team     string
	Teamid   string
	Goal     string
	Appear   string
	Period   string
	Penalty  string
	Epicycle string
	Point    string
}

type PlayerrankElement

type PlayerrankElement struct {
	Id         string
	Name       string
	Playerrank []PlayerRank
}

type Post

type Post struct {
	Id           int
	User         *User     `orm:"rel(fk)"`
	Title        string    `orm:"size(60)"`
	Content      string    `orm:"type(text)"`
	ContentCache string    `orm:"type(text)"`
	Browsers     int       `orm:"index"`
	Replys       int       `orm:"index"`
	TodayReplys  int       `orm:"index"`
	Favorites    int       `orm:"index"`
	LastReply    *User     `orm:"rel(fk);null"`
	LastAuthor   *User     `orm:"rel(fk);null"`
	Topic        *Topic    `orm:"rel(fk)"`
	Lang         int       `orm:"index"`
	IsBest       bool      `orm:"index"`
	IsTop        bool      `orm:"index"`
	Category     *Category `orm:"rel(fk)"`
	Created      time.Time `orm:"auto_now_add"`
	Updated      time.Time `orm:"auto_now;index"`
}

post content

func (*Post) Appends

func (m *Post) Appends() orm.QuerySeter

func (*Post) Comments

func (m *Post) Comments() orm.QuerySeter

func (*Post) Delete

func (m *Post) Delete() error

func (*Post) GetContentCache

func (m *Post) GetContentCache() string

func (*Post) GetLang

func (m *Post) GetLang() string

func (*Post) Insert

func (m *Post) Insert() error
func (m *Post) Link() string

func (*Post) Read

func (m *Post) Read(fields ...string) error

func (*Post) String

func (m *Post) String() string

func (*Post) Update

func (m *Post) Update(fields ...string) error

type Setting

type Setting struct {
	Id      int
	Name    string `orm:"unique"`
	Value   string `orm:"type(text)"`
	Updated string `orm:"auto_now"`
}

global settings name -> value

type SliceStringField

type SliceStringField []string

A true/false field.

func (*SliceStringField) Add

func (e *SliceStringField) Add(v string)

func (*SliceStringField) Clean

func (e *SliceStringField) Clean() error

func (*SliceStringField) FieldType

func (e *SliceStringField) FieldType() int

func (*SliceStringField) RawValue

func (e *SliceStringField) RawValue() interface{}

func (*SliceStringField) Set

func (e *SliceStringField) Set(d []string)

func (*SliceStringField) SetRaw

func (e *SliceStringField) SetRaw(value interface{}) error

func (*SliceStringField) String

func (e *SliceStringField) String() string

func (SliceStringField) Value

func (e SliceStringField) Value() []string

type Standing

type Standing struct {
	Ranking  string
	Name     string
	Teamid   string
	Appear   string
	Win      string
	Draw     string
	Lose     string
	Goal     string
	Conceded string
	Point    string
}

type StandingElement

type StandingElement struct {
	Id        string
	Name      string
	Standings []Standing
}

type Topic

type Topic struct {
	Id        int
	Name      string    `orm:"size(30);unique"`
	Intro     string    `orm:"type(text)"`
	NameZhCn  string    `orm:"size(30);unique"`
	IntroZhCn string    `orm:"type(text)"`
	Image     *Image    `orm:"rel(one);null"`
	ImgUrl    string    `orm:"size(300)"`
	Slug      string    `orm:"size(100);unique"`
	Followers int       `orm:"index"`
	Order     int       `orm:"index"`
	Created   time.Time `orm:"auto_now_add"`
	Updated   time.Time `orm:"auto_now;index"`
}

post topic

func (*Topic) Delete

func (m *Topic) Delete() error

func (*Topic) GetIntro

func (m *Topic) GetIntro(lang string) string

func (*Topic) GetName

func (m *Topic) GetName(lang string) string

func (*Topic) Insert

func (m *Topic) Insert() error
func (m *Topic) Link() string

func (*Topic) Read

func (m *Topic) Read(fields ...string) error

func (*Topic) RefreshFollowers

func (m *Topic) RefreshFollowers() int

func (*Topic) String

func (m *Topic) String() string

func (*Topic) Update

func (m *Topic) Update(fields ...string) error

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)"`
	Location    string           `orm:"size(30)"`
	Email       string           `orm:"size(80);unique"`
	GrEmail     string           `orm:"size(32)"`
	Alipay      string           `orm:"size(80)"`
	Paypal      string           `orm:"size(80)"`
	MobilePhone string           `orm:"size(20)"`
	Weixin      string           `orm:"size(30)"`
	Weibo       string           `orm:"size(30)"`
	QQ          string           `orm:"size(30)"`
	Info        string           ``
	PublicEmail bool             ``
	Followers   int              ``
	Following   int              ``
	FavTopics   int              ``
	Coins       int              ``
	IsAdmin     bool             `orm:"index"`
	IsActive    bool             `orm:"index"`
	IsForbid    bool             `orm:"index"`
	Identity    int              `orm:"index"`
	Score       int              `orm:"index"`
	Coin        int              `orm:"index"`
	Lang        int              `orm:"index"`
	LangAdds    SliceStringField `orm:"size(50)"`
	Rands       string           `orm:"size(10)"`
	Created     time.Time        `orm:"auto_now_add"`
	Updated     time.Time        `orm:"auto_now"`
}

main user table IsAdmin: user is admininstator IsActive: set active when email is verified IsForbid: forbid user login

func (m *User) AvatarLink() string

func (*User) Delete

func (m *User) Delete() error

func (*User) FollowerUsers

func (m *User) FollowerUsers() orm.QuerySeter

func (*User) FollowingUsers

func (m *User) FollowingUsers() orm.QuerySeter

func (*User) Insert

func (m *User) Insert() error
func (m *User) Link() string

func (*User) Read

func (m *User) Read(fields ...string) error

func (*User) RecentComments

func (m *User) RecentComments() orm.QuerySeter

func (*User) RecentPosts

func (m *User) RecentPosts() orm.QuerySeter

func (*User) RefreshFavTopics

func (m *User) RefreshFavTopics() int

func (*User) String

func (m *User) String() string

func (*User) Update

func (m *User) Update(fields ...string) error

Jump to

Keyboard shortcuts

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