model

package
v0.0.0-...-742107e Latest Latest
Warning

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

Go to latest
Published: May 18, 2022 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buf

type Buf struct {
	Category   *Category
	Categories *Categories
	Comment    *Comment
	Comments   *Comments
	Like       *Ratio
	LCount     *LCount
	LikesCount *LikesCount
	Post       *Post
	Posts      *Posts
	Session    *Session
	User       *User
	Users      *Users
	CheckID    *CheckID
}

Buf for return struct by name

type Categories

type Categories struct {
	Slice []*Category
	St    *object.Settings
	Ck    *object.Cookie
}

func NewCategories

func NewCategories(st *object.Settings, ck *object.Cookie) *Categories

func (*Categories) GetList

func (c *Categories) GetList() *object.QuerySettings

func (*Categories) IfNil

func (c *Categories) IfNil() interface{}

func (*Categories) MakeKeys

func (c *Categories) MakeKeys(key string, data ...interface{})

func (*Categories) NewList

func (c *Categories) NewList() []interface{}

func (*Categories) Return

func (c *Categories) Return() *Buf

type Category

type Category struct {
	ID   int
	Name string
}

func (*Category) IfNil

func (c *Category) IfNil() interface{}

type CheckID

type CheckID struct {
	ID  int
	Obj object.Obj
}

func NewCheckID

func NewCheckID(st *object.Settings, sts *object.Statuses, ck *object.Cookie) *CheckID

func (*CheckID) Get

func (c *CheckID) Get() *object.QuerySettings

func (*CheckID) MakeKeys

func (c *CheckID) MakeKeys(key string, data ...interface{})

func (*CheckID) New

func (c *CheckID) New() []interface{}

type Comment

type Comment struct {
	ID      int
	Title   *Post // refer to post
	Body    string
	User    int
	Name    string
	Created time.Time
	Likes   interface{}
	Liked   interface{}
	Post    int
}

func (*Comment) IfNil

func (c *Comment) IfNil() interface{}

type Comments

type Comments struct {
	Slice []*Comment
	St    *object.Settings
	Ck    *object.Cookie
}

func NewComments

func NewComments(st *object.Settings, ck *object.Cookie) *Comments

func (*Comments) Add

func (c *Comments) Add(key string, index int, data interface{})

func (*Comments) Cookie

func (c *Comments) Cookie() *object.Cookie

func (*Comments) GetList

func (c *Comments) GetList() *object.QuerySettings

func (*Comments) IfNil

func (c *Comments) IfNil() interface{}

func (*Comments) KeyLiked

func (c *Comments) KeyLiked() string

func (*Comments) KeyRole

func (c *Comments) KeyRole() string

func (*Comments) LSlice

func (c *Comments) LSlice() int

func (*Comments) MakeKeys

func (c *Comments) MakeKeys(key string, data ...interface{})

func (*Comments) NewList

func (c *Comments) NewList() []interface{}

func (*Comments) PostOrCommentID

func (c *Comments) PostOrCommentID(index int) int

func (*Comments) Return

func (c *Comments) Return() *Buf

func (*Comments) Settings

func (c *Comments) Settings() *object.Settings

type LCount

type LCount struct {
	Like       int    // like_id or dislike_id
	Body       string // like or dislike (name)
	Count      int    // number of likes/dislikes
	Session    bool   // logged user or not
	AllPost    bool   // one post window or not
	PostOrComm int    // current post_id or comment_id
}

type LikesCount

type LikesCount struct {
	Slice      []*LCount
	PostOrComm int // current post_id or comment_id
	St         *object.Settings
	Ck         *object.Cookie
}

func NewLikesCount

func NewLikesCount(st *object.Settings, ck *object.Cookie) *LikesCount

func (*LikesCount) DislikeNil

func (lk *LikesCount) DislikeNil() *LCount

func (*LikesCount) GetList

func (lk *LikesCount) GetList() *object.QuerySettings

GetList configs query

func (*LikesCount) IfNil

func (lk *LikesCount) IfNil() interface{}

func (*LikesCount) LikeNil

func (lk *LikesCount) LikeNil() *LCount

func (*LikesCount) MakeKeys

func (lk *LikesCount) MakeKeys(key string, data ...interface{})

func (*LikesCount) NewList

func (lk *LikesCount) NewList() []interface{}

NewList returns fields for adding new data in "query rows"

func (*LikesCount) Return

func (lk *LikesCount) Return() *Buf

type Model

type Model interface {
	New() []interface{}
	Get() *object.QuerySettings
}

type Models

type Models interface {
	NewList() []interface{}
	GetList() *object.QuerySettings
	Return() *Buf
}

type Post

type Post struct {
	ID         int
	Title      string
	Body       string
	User       int
	Name       string
	Created    time.Time
	Categories any
	Likes      any
	Comments   *Comments
	Liked      any
	Image      any
	St         *object.Settings
	Ck         *object.Cookie
}

func NewPost

func NewPost(st *object.Settings, ck *object.Cookie) *Post

func (*Post) Get

func (p *Post) Get() *object.QuerySettings

func (*Post) IfNil

func (p *Post) IfNil() interface{}

func (*Post) MakeKeys

func (p *Post) MakeKeys(key string, data ...interface{})

func (*Post) New

func (p *Post) New() []interface{}

type PostOrComment

type PostOrComment interface {
	LSlice() int
	PostOrCommentID(index int) int
	Add(key string, index int, data interface{})
	Cookie() *object.Cookie
	Settings() *object.Settings
	KeyRole() string
	KeyLiked() string
}

type Posts

type Posts struct {
	Slice []*Post
	St    *object.Settings
	Ck    *object.Cookie
}

func NewPosts

func NewPosts(st *object.Settings, ck *object.Cookie) *Posts

func (*Posts) Add

func (p *Posts) Add(key string, index int, data interface{})

Add adding information to slice post/comment by index

func (*Posts) Cookie

func (p *Posts) Cookie() *object.Cookie

func (*Posts) GetList

func (p *Posts) GetList() *object.QuerySettings

func (*Posts) IfNil

func (p *Posts) IfNil() interface{}

func (*Posts) KeyLiked

func (p *Posts) KeyLiked() string

func (*Posts) KeyRole

func (p *Posts) KeyRole() string

func (*Posts) LSlice

func (p *Posts) LSlice() int

func (*Posts) MakeKeys

func (p *Posts) MakeKeys(key string, data ...interface{})

func (*Posts) NewList

func (p *Posts) NewList() []interface{}

func (*Posts) PostOrCommentID

func (p *Posts) PostOrCommentID(index int) int

func (*Posts) Return

func (p *Posts) Return() *Buf

func (*Posts) Settings

func (p *Posts) Settings() *object.Settings

type Ratio

type Ratio struct {
	PostOrComm int       // current post_id or comment_id
	Ratio      int       // like_id or dislike_id
	Body       string    // like or dislike (name)
	Created    time.Time // created date
	St         *object.Settings
	Ck         *object.Cookie
}

func NewLike

func NewLike(st *object.Settings, ck *object.Cookie) *Ratio

func (*Ratio) Get

func (l *Ratio) Get() *object.QuerySettings

func (*Ratio) MakeKeys

func (l *Ratio) MakeKeys(key string, data ...interface{})

func (*Ratio) New

func (l *Ratio) New() []interface{}

type Session

type Session struct {
	User   string
	UUID   string
	Expire time.Time
	St     *object.Settings // settings
	Ck     *object.Cookie
}

func NewSession

func NewSession(st *object.Settings, ck *object.Cookie) *Session

func (*Session) Get

func (s *Session) Get() *object.QuerySettings

func (*Session) New

func (s *Session) New() []interface{}

type User

type User struct {
	ID       int
	Login    string
	Name     string
	Password string
	Email    string
	Root     int
	Created  time.Time
	St       *object.Settings
	Ck       *object.Cookie
}

func NewUser

func NewUser(st *object.Settings, ck *object.Cookie) *User

func (*User) Get

func (u *User) Get() *object.QuerySettings

func (*User) MakeKeys

func (u *User) MakeKeys(key string, data ...interface{})

func (*User) New

func (u *User) New() []interface{}

type Users

type Users struct {
	Users []*User
	St    *object.Settings
	Ck    *object.Cookie
}

Jump to

Keyboard shortcuts

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