dto

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: 15 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
	CategoryPost *CategoryPost
	Comment      *Comment
	Like         *Ratio
	Post         *Post
	Session      *Session
}

type Category

type Category struct {
	Name string `json:"name"`
}

func (*Category) Add

func (c *Category) Add(r *http.Request)

func (*Category) Create

func (c *Category) Create() *object.QuerySettings

func (*Category) Delete

func (c *Category) Delete([]interface{})

type CategoryPost

type CategoryPost struct {
	Post     int      // current new created
	Category int      // current id from slice
	Slice    []string // from http response
	ID       []int    // checked for valid from http response
}

func NewCategoryPost

func NewCategoryPost() *CategoryPost

func (*CategoryPost) Create

func (cp *CategoryPost) Create() *object.QuerySettings

func (*CategoryPost) Delete

func (cp *CategoryPost) Delete() *object.QuerySettings

type CheckID

type CheckID struct {
	Atoi     bool        // if true - must use IDString
	IDString string      // will use if Atoi = true
	ID       interface{} // will use if Atoi = false
	Who      string
}

func NewCheckID

func NewCheckID(who string, id interface{}) *CheckID

func NewCheckIDAtoi

func NewCheckIDAtoi(who string, id string) *CheckID

type Comment

type Comment struct {
	Body string
	Obj  object.Obj
}

func NewComment

func NewComment(st *object.Settings, sts *object.Statuses, ck *object.Cookie) *Comment

func (*Comment) Add

func (c *Comment) Add(r *http.Request) bool

func (*Comment) Create

func (c *Comment) Create() *object.QuerySettings

func (*Comment) Delete

func (c *Comment) Delete() *object.QuerySettings

func (*Comment) Valid

func (c *Comment) Valid() bool

type DTO

type DTO interface {
	Create() *object.QuerySettings
	Delete() *object.QuerySettings
}

type FileMaker

type FileMaker struct {
	Path string
	Type string
	Src  *FileSrc
	Obj  object.Obj
}

func NewFileMaker

func NewFileMaker(st *object.Settings, sts *object.Statuses, ck *object.Cookie) *FileMaker

func (*FileMaker) Create

func (fm *FileMaker) Create() *object.QuerySettings

func (*FileMaker) Delete

func (i *FileMaker) Delete() *object.QuerySettings

func (*FileMaker) MakeKeys

func (fm *FileMaker) MakeKeys(key string, data ...any)

type FileSrc

type FileSrc struct {
	Body []byte
	MIME string
}

type Post

type Post struct {
	Title      string
	Body       string
	Image      *FileMaker
	Categories *CategoryPost
	Obj        object.Obj
}

func NewPost

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

func (*Post) Add

func (p *Post) Add(r *http.Request) bool

func (*Post) Create

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

func (*Post) Delete

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

func (*Post) Valid

func (p *Post) Valid() bool

type Ratio

type Ratio struct {
	PostOrComm map[string]string // post or comment - map[post]id
	Ratio      int               // like/dislike
	Obj        object.Obj
}

func NewRatio

func NewRatio(st *object.Settings, sts *object.Statuses, ck *object.Cookie) *Ratio

func (*Ratio) AddByGET

func (r *Ratio) AddByGET(request *http.Request) bool

func (*Ratio) AddByPOST

func (r *Ratio) AddByPOST(request *http.Request) bool

func (*Ratio) Create

func (r *Ratio) Create() *object.QuerySettings

Create prepares query for db and choose fields for adding incoming data

func (*Ratio) Delete

func (r *Ratio) Delete() *object.QuerySettings

func (*Ratio) MakeKeys

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

type Session

type Session struct {
	Expire time.Time
	Obj    object.Obj
}

func NewSession

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

func (*Session) Add

func (s *Session) Add(date time.Time)

func (*Session) Create

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

func (*Session) Delete

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

type User

type User struct {
	IdSub      any    `json:"sub"` // for google id
	Id         any    `json:"id"`  // (not exported) only for authentication from social network
	Login      string `json:"login"`
	Name       string `json:"name"`
	Password   string
	RePassword string
	Email      string `json:"email"`
	ReEmail    string
	Created    time.Time
	Obj        object.Obj
}

func NewUser

func NewUser(st *object.Settings, sts *object.Statuses) *User

func (*User) Add

func (u *User) Add(r *http.Request)

func (*User) AddJSON

func (u *User) AddJSON(data []byte) error

func (*User) Create

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

func (*User) CryptPassword

func (u *User) CryptPassword() bool

func (*User) Delete

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

func (*User) MakeKeys

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

func (*User) ValidEmail

func (u *User) ValidEmail() bool

func (*User) ValidLogin

func (u *User) ValidLogin() bool

func (*User) ValidPassword

func (u *User) ValidPassword() bool

Jump to

Keyboard shortcuts

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