models

package
v0.0.0-...-16d2632 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2020 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EVENT_JOIN = iota
	EVENT_LEAVE
	EVENT_MESSAGE
)

Variables

This section is empty.

Functions

func NewArchive

func NewArchive(event Event)

NewArchive saves new event to archive list.

Types

type Article

type Article struct {
	Id           int     `orm:"column(id);auto"`
	Code         string  `orm:"column(code);size(255);"`
	Key          string  `orm:"column(key);size(255);"`
	User         *User   `orm:"rel(fk)"`
	FileName     string  `orm:"column(filename);size(255);"`
	Title        string  `orm:"column(title);size(255);"`
	ShortContent string  `orm:"column(shortcontent);size(4000)"`
	Content      string  `orm:"column(content);size(4000)"`
	Score        float32 `orm:"column(score);"`
	PublishDate  string  `orm:"column(publish_date);"`

	Director       string    `orm:"column(director);size(100)"`
	Actor          string    `orm:"column(actor);size(1000)"`
	Time           string    `orm:"column(time);size(30)"`
	PublishYear    string    `orm:"column(publish_year);"`
	Language       string    `orm:"column(language);size(30)"`
	Duration       string    `orm:"column(duration);size(30)"`
	National       string    `orm:"column(national);size(30)"`
	CreateTime     time.Time `orm:"column(create_time);type(timestamp);auto_now_add"`
	Type           int
	Stars          int // we may need redis help with this
	AllowComments  bool
	AllowReviews   bool
	FilmImage      string            `orm:"column(filmImage);size(300)" `
	PosterImage    string            `orm:"column(posterImage);size(300)" `
	TopicTags      string            `orm:"column(topictags);size(300)" `
	TaggedUsers    string            `orm:"column(taggedusers);size(300)" `
	Category       string            `orm:"column(category);size(1000)"`
	ArticleComment []*ArticleComment `orm:"reverse(many)"`
	Likes          []*ArticleLike    `orm:"reverse(many)"`
	Status         string            `orm:"column(status);size(100)"`
	Hightlight     string            `orm:"column(hightlight);size(20)"`
}

Article model articles in db

func GetListArticle

func GetListArticle(page, pageSize int, filters ...interface{}) ([]*Article, int64)

type ArticleComment

type ArticleComment struct {
	Id      int            `orm:"column(id);auto"`
	User    *User          `orm:"rel(fk)"`
	Article *Article       `orm:"rel(fk)"`
	Likes   []*CommentLike `orm:"reverse(many)"`
}

ArticleComment model articles_comments in db

type ArticleFile

type ArticleFile struct {
	Id         int    `orm:"column(id);auto"`
	ArticleId  int    `orm:"column(article_id)"`
	Key        string `orm:"column(key);size(255);"`
	Code       string `orm:"column(code);size(255);"`
	FileName   string `orm:"column(filename);size(255);"`
	Title      string `orm:"column(title);size(255);"`
	Status     string `orm:"column(status);size(100)"`
	StreamSize int    `orm:"column(stream_size)"`
	BitRate    int    `orm:"column(bit_rate)"`
	ViewCount  int    `orm:"column(view_count)"`
}

type ArticleForm

type ArticleForm struct {
	Id            int               `form:"id"`
	Key           string            `form:"key" valid:"Required;MinSize(1);MaxSize(300)"`
	User          *User             `form:"user" valid:"Required;"`
	FileName      string            `form:"file_name" valid:"Required;MinSize(1);MaxSize(300)"`
	ShortContent  string            `form:"short_content"`
	Score         float32           `form:"score" `
	PublishDate   string            `form:"publish_date" `
	Director      string            `form:"director" `
	Actor         string            `form:"actor" `
	Time          string            `form:"time" `
	PublishYear   string            `form:"publish_year" `
	Language      string            `form:"language" `
	Duration      string            `form:"duration" `
	National      string            `form:"national"`
	Title         string            `form:"title" valid:"Required;MinSize(1);MaxSize(300)"`
	Category      string            `form:"category"`
	Content       string            `form:"content" valid:"Required;MinSize(1);MaxSize(2000)"`
	TopicTags     string            `form:"topic_tags" valid:"MinSize(0);MaxSize(300)"`
	TaggedUsers   string            `form:"tagged_users" valid:"MinSize(0);MaxSize(300)"`
	FilmImage     string            `form:"filmImage" valid:"MinSize(0);MaxSize(300)"`
	PosterImage   string            `form:"posterImage" valid:"MinSize(0);MaxSize(300)"`
	AllowReviews  bool              `form:"allow_reviews" valid:"Required"`
	AllowComments bool              `form:"allow_comments" valid:"Required"`
	InvalidFields map[string]string `form:"-"`
	Status        string            `form:"status"`
	Hightlight    string            `form:"hightlight"`
}

ArticleForm ...

func (*ArticleForm) Validate

func (form *ArticleForm) Validate() bool

Validate ArticleForm data

type ArticleLike

type ArticleLike struct {
	Id         int       `orm:"column(id);auto"`
	User       *User     `orm:"rel(fk)"`
	CreateTime time.Time `orm:"column(create_time);type(timestamp);auto_now_add"`
	Article    *Article  `orm:"rel(fk)"`
}

ArticleLike model

type Block

type Block struct {
	Id         int       `orm:"column(id);auto"`
	Name       string    `orm:"column(title);size(255);"`
	Content    string    `orm:"column(content);size(128)"`
	CreateTime time.Time `orm:"column(create_time);type(timestamp);auto_now_add"`
	Type       string    `orm:"column(type);size(128)"`
	IsActive   bool
	Position   int
}

Block model blocks in db

type BlockConfig

type BlockConfig struct {
	Id         int            `orm:"column(id);auto"`
	Block      *Block         `orm:"rel(fk)"`
	Key        string         `orm:"column(title);size(255);"`
	Value      string         `orm:"column(title);size(255);"`
	Type       string         `orm:"column(title);size(255);"`
	CreateTime time.Time      `orm:"column(create_time);type(timestamp);auto_now_add"`
	Config     []*BlockConfig `orm:"reverse(many)"`
}

BlockConfig model

type Category

type Category struct {
	Id   int    `orm:"column(id);auto"`
	Key  string `orm:"column(key);size(128)"`
	Name string `orm:"column(name);size(128)"`
	Type int    `orm:"column(type)"`
}

Category model categories in db

type CommentLike

type CommentLike struct {
	Id         int             `orm:"column(id);auto"`
	User       *User           `orm:"rel(fk)"`
	CreateTime time.Time       `orm:"column(create_time);type(timestamp);auto_now_add"`
	Comment    *ArticleComment `orm:"rel(fk)"`
}

CommentLike model

type Event

type Event struct {
	Type      EventType // JOIN, LEAVE, MESSAGE
	User      string
	Timestamp int // Unix timestamp (secs)
	Content   string
}

func GetEvents

func GetEvents(lastReceived int) []Event

GetEvents returns all events after lastReceived.

type EventType

type EventType int

type Image

type Image struct {
	Id       int    `orm:"column(id);auto"`
	User     *User  `orm:"rel(fk)"`
	Title    string `orm:"column(title);size(255);"`
	Url      string `orm:"column(url);size(255);"`
	Type     int
	Category *Category `orm:"rel(fk);null;default(null)"`
}

Image model articles in db

type ImageForm

type ImageForm struct {
	Name          string            `form:"name" valid:"Required;"`
	User          int               `form:"user" valid:"Required;Numeric"`
	Targets       string            `form:"target" valid:"Required;"`
	PivoteX       int               `form:"pivotex" valid:"Required;Numeric"`
	PivoteY       int               `form:"pivotey" valid:"Required;Numeric"`
	ImageType     string            `form:"name" valid:"Required;"`
	Description   string            `form:"description" valid:"Required;AlphaNumeric;MinSize(4);MaxSize(300)"`
	File          []byte            `form:"-"`
	InvalidFields map[string]string `form:"-"`
}

ImageForm ...

func (*ImageForm) Validate

func (form *ImageForm) Validate() bool

Validate ImageForm data

type Profile

type Profile struct {
	Id          int
	User        *User `orm:"reverse(one)"`
	Name        string
	Avatar      string
	Age         int16
	Lema        string
	Description string
	Gender      bool
}

Profile model

func (*Profile) GetPermissions

func (*Profile) GetPermissions(user User) string

GetPermissions get user permissions data

type RegisterForm

type RegisterForm struct {
	Name          string            `form:"name" valid:"Required;"`
	Email         string            `form:"email" valid:"Required;"`
	Username      string            `form:"username" valid:"Required;AlphaNumeric;MinSize(4);MaxSize(300)"`
	Password      string            `form:"password" valid:"Required;MinSize(4);MaxSize(30)"`
	PasswordRe    string            `form:"passwordre" valid:"Required;MinSize(4);MaxSize(30)"`
	Gender        bool              `form:"gender" valid:"Required"`
	InvalidFields map[string]string `form:"-"`
}

RegisterForm ...

func (*RegisterForm) Validate

func (form *RegisterForm) Validate() bool

Validate RegisterForm data

type Style

type Style struct {
	Id         int       `orm:"column(id);auto"`
	Name       string    `orm:"column(name);size(50);unique"`
	Template   *Template `orm:"rel(fk)"`
	Active     bool      `orm:"column(active)"`
	CreateTime time.Time `orm:"column(create_time);type(timestamp);auto_now_add"`
}

Style model

type Template

type Template struct {
	Id         int       `orm:"column(id);auto"`
	Name       string    `orm:"column(name);size(50);unique"`
	Style      []*Style  `orm:"reverse(many)"`
	Active     bool      `orm:"column(active)"`
	CreateTime time.Time `orm:"column(create_time);type(timestamp);auto_now_add"`
}

Template model

type UploadResultJSON

type UploadResultJSON struct {
	Id  int    `json:"id"`
	Msg string `json:"message"`
	Url string `orm:"column(url);size(255);"`
}

UploadResultJSON model articles in db

type User

type User struct {
	Id         int       `orm:"column(id);auto"`
	Username   string    `orm:"column(username);size(50);unique"`
	Email      string    `orm:"column(email);size(255);"`
	Password   string    `orm:"column(password);size(128)"`
	CreateTime time.Time `orm:"column(create_time);type(timestamp);auto_now_add"`
	Admin      bool      `orm:"column(admin)"`
	Rands      string    `orm:"size(10)"`
	Profile    *Profile  `orm:"rel(one)"`
	//Article     []*Article `orm:"reverse(many)"`
	Permissions string
}

User model

Jump to

Keyboard shortcuts

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