models

package
v0.0.0-...-3122bcc Latest Latest
Warning

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

Go to latest
Published: Dec 27, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrderStatusInBasket = iota
	OrderStatusInProcessing
	OrderStatusPaid
	OrderStatusClosed
	OrderStatusError = 255
)
View Source
const EmailWithRus = "^[^\\s()<>@,;:\\/]+@[\\wА-Яа-я][\\wА-Яа-я.-]+\\.[a-zа-я]{2,}$"
View Source
const MinLenPassword = 6

Variables

This section is empty.

Functions

This section is empty.

Types

type Category

type Category struct {
	ID   uint64 `json:"id"         valid:"required"`
	Name string `` //nolint
	/* 135-byte string literal not displayed */
	ParentID sql.NullInt64 `json:"parent_id"  swaggertype:"integer" valid:"required"`
}

func (*Category) MarshalJSON

func (c *Category) MarshalJSON() ([]byte, error)

func (*Category) SafeUnmarshalJSON

func (c *Category) SafeUnmarshalJSON(bytes []byte) error

func (*Category) Sanitize

func (c *Category) Sanitize()

type City

type City struct {
	ID   uint64 `json:"id"     valid:"required"`
	Name string `json:"name"   valid:"required, length(1|256)~City name length must be from 1 to 256"`
}

func (City) MarshalEasyJSON

func (v City) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (City) MarshalJSON

func (v City) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*City) Sanitize

func (c *City) Sanitize()

func (*City) UnmarshalEasyJSON

func (v *City) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*City) UnmarshalJSON

func (v *City) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type Comment

type Comment struct {
	ID          uint64 `json:"id"           valid:"required"`
	SenderID    uint64 `json:"sender_id"    valid:"required"`
	RecipientID uint64 `json:"recipient_id" valid:"required"`
	Text        string `` //nolint:nolintlint
	/* 136-byte string literal not displayed */
	Rating    uint8     `json:"rating"       valid:"required,range(1|5)"`
	CreatedAt time.Time `json:"created_at"   valid:"required"`
}

type CommentChanges

type CommentChanges struct {
	Text string `` //nolint:nolintlint
	/* 136-byte string literal not displayed */
	Rating uint8 `json:"rating"       valid:"required,range(1|5)"`
}

func (CommentChanges) MarshalEasyJSON

func (v CommentChanges) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (CommentChanges) MarshalJSON

func (v CommentChanges) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*CommentChanges) Trim

func (c *CommentChanges) Trim()

func (*CommentChanges) UnmarshalEasyJSON

func (v *CommentChanges) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*CommentChanges) UnmarshalJSON

func (v *CommentChanges) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type CommentInFeed

type CommentInFeed struct {
	ID         uint64         `json:"id"           valid:"required"`
	SenderID   uint64         `json:"sender_id"    valid:"required"`
	SenderName string         `json:"sender_name"`
	Avatar     sql.NullString `json:"avatar"     swaggertype:"string"`
	Text       string         `` //nolint:nolintlint
	/* 136-byte string literal not displayed */
	Rating    uint8     `json:"rating"       valid:"required,min=1,max=5"`
	CreatedAt time.Time `json:"created_at"   valid:"required"`
}

func (*CommentInFeed) MarshalJSON

func (c *CommentInFeed) MarshalJSON() ([]byte, error)

func (*CommentInFeed) Sanitize

func (c *CommentInFeed) Sanitize()

func (*CommentInFeed) UnmarshalJSON

func (c *CommentInFeed) UnmarshalJSON(bytes []byte) error

type Image

type Image struct {
	URL string `json:"url" valid:"required"`
}

type Order

type Order struct {
	ID        uint64       `json:"id"          valid:"required"`
	OwnerID   uint64       `json:"owner_id"    valid:"required"`
	ProductID uint64       `json:"product_id"  valid:"required"`
	Count     uint32       `json:"count"       valid:"required"`
	Status    uint8        `json:"status"      valid:"required"`
	CreatedAt time.Time    `json:"created_at"  valid:"required"`
	UpdatedAt time.Time    `json:"updated_at"  valid:"required"`
	ClosedAt  sql.NullTime `json:"closed_at"   swaggertype:"string" example:"2014-12-12T14:00:12+07:00"  valid:"required"`
}

func (*Order) MarshalJSON

func (o *Order) MarshalJSON() ([]byte, error)

func (*Order) UnmarshalJSON

func (o *Order) UnmarshalJSON(bytes []byte) error

type OrderChanges

type OrderChanges struct {
	ID     uint64 `json:"id"      valid:"required"`
	Count  uint32 `json:"count"   valid:"required"`
	Status uint8  `json:"status"  valid:"required"`
}

func (OrderChanges) MarshalEasyJSON

func (v OrderChanges) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderChanges) MarshalJSON

func (v OrderChanges) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderChanges) UnmarshalEasyJSON

func (v *OrderChanges) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderChanges) UnmarshalJSON

func (v *OrderChanges) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderInBasket

type OrderInBasket struct {
	ID             uint64  `json:"id"              valid:"required"`
	OwnerID        uint64  `json:"owner_id"        valid:"required"`
	SalerID        uint64  `json:"saler_id"        valid:"required"`
	ProductID      uint64  `json:"product_id"      valid:"required"`
	CityID         uint64  `json:"city_id"         valid:"required"`
	Title          string  `json:"title"           valid:"required, length(1|256)~Title length must be from 1 to 256"`
	Price          uint64  `json:"price"           valid:"required"`
	Count          uint32  `json:"count"           valid:"required"`
	AvailableCount uint32  `json:"available_count" valid:"required"`
	Delivery       bool    `json:"delivery"        valid:"required"`
	SafeDeal       bool    `json:"safe_deal"       valid:"required"`
	InFavourites   bool    `json:"in_favourites"   valid:"required"`
	Images         []Image `json:"images"`
}

func (OrderInBasket) MarshalEasyJSON

func (v OrderInBasket) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderInBasket) MarshalJSON

func (v OrderInBasket) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderInBasket) Sanitize

func (o *OrderInBasket) Sanitize()

func (*OrderInBasket) UnmarshalEasyJSON

func (v *OrderInBasket) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderInBasket) UnmarshalJSON

func (v *OrderInBasket) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type OrderNotInBasket

type OrderNotInBasket struct {
	OrderInBasket
	Status int `json:"status"`
}

func (OrderNotInBasket) MarshalEasyJSON

func (v OrderNotInBasket) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (OrderNotInBasket) MarshalJSON

func (v OrderNotInBasket) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*OrderNotInBasket) UnmarshalEasyJSON

func (v *OrderNotInBasket) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*OrderNotInBasket) UnmarshalJSON

func (v *OrderNotInBasket) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PreComment

type PreComment struct {
	SenderID    uint64 `json:"sender_id"    valid:"required"`
	RecipientID uint64 `json:"recipient_id" valid:"required"`
	Text        string `` //nolint:nolintlint
	/* 136-byte string literal not displayed */
	Rating uint8 `json:"rating"       valid:"required,range(1|5)"`
}

func (PreComment) MarshalEasyJSON

func (v PreComment) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PreComment) MarshalJSON

func (v PreComment) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PreComment) Trim

func (p *PreComment) Trim()

func (*PreComment) UnmarshalEasyJSON

func (v *PreComment) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PreComment) UnmarshalJSON

func (v *PreComment) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PreOrder

type PreOrder struct {
	ProductID uint64 `json:"product_id" valid:"required"`
	Count     uint32 `json:"count"      valid:"required"`
}

func (PreOrder) MarshalEasyJSON

func (v PreOrder) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PreOrder) MarshalJSON

func (v PreOrder) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PreOrder) UnmarshalEasyJSON

func (v *PreOrder) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PreOrder) UnmarshalJSON

func (v *PreOrder) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PreProduct

type PreProduct struct {
	SalerID    uint64 `json:"saler_id"        valid:"required"`
	CategoryID uint64 `json:"category_id"     valid:"required"`
	CityID     uint64 `json:"city_id"         valid:"required"`
	Title      string `` //nolint:nolintlint
	/* 143-byte string literal not displayed */
	Description string `` //nolint:nolintlint
	/* 145-byte string literal not displayed */
	Price          uint64  `json:"price"           valid:"required"`
	AvailableCount uint32  `json:"available_count" valid:"required"`
	Delivery       bool    `json:"delivery"        valid:"optional"`
	SafeDeal       bool    `json:"safe_deal"       valid:"optional"`
	IsActive       bool    `json:"is_active"       valid:"optional"`
	Images         []Image `json:"images"`
}

PreProduct @Description safe_deal optional @Description delivery optional

func (PreProduct) MarshalEasyJSON

func (v PreProduct) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (PreProduct) MarshalJSON

func (v PreProduct) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*PreProduct) Trim

func (p *PreProduct) Trim()

func (*PreProduct) UnmarshalEasyJSON

func (v *PreProduct) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*PreProduct) UnmarshalJSON

func (v *PreProduct) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type PriceHistoryRecord

type PriceHistoryRecord struct {
	Price     uint64    `json:"price"           valid:"required"`
	CreatedAt time.Time `json:"created_at"      valid:"required"`
}

type Product

type Product struct {
	ID         uint64 `json:"id"              valid:"required"`
	SalerID    uint64 `json:"saler_id"        valid:"required"`
	CategoryID uint64 `json:"category_id"     valid:"required"`
	CityID     uint64 `json:"city_id"         valid:"required"`
	Title      string `` //nolint:nolintlint
	/* 143-byte string literal not displayed */
	Description string `` //nolint:nolintlint
	/* 145-byte string literal not displayed */
	Price          uint64               `json:"price"           valid:"required"`
	CreatedAt      time.Time            `json:"created_at"      valid:"required"`
	PremiumExpire  sql.NullTime         `json:"premium_expire"  swaggertype:"string" example:"2014-12-12T14:00:12+07:00"  valid:"optional"` //nolint:nolintlint
	Views          uint32               `json:"views"           valid:"required"`
	AvailableCount uint32               `json:"available_count" valid:"required"`
	Delivery       bool                 `json:"delivery"        valid:"optional"`
	SafeDeal       bool                 `json:"safe_deal"       valid:"optional"`
	InFavourites   bool                 `json:"in_favourites"   valid:"optional"`
	IsActive       bool                 `json:"is_active"       valid:"optional"`
	Premium        bool                 `json:"premium"         valid:"required"`
	Images         []Image              `json:"images"`
	PriceHistory   []PriceHistoryRecord `json:"price_history"   valid:"optional"`
	Favourites     uint64               `json:"favourites"      valid:"required"`
	CommentID      sql.NullInt64        `json:"comment_id"  swaggertype:"integer" example:"10"  valid:"optional"` //nolint:nolintlint
}

func (*Product) MarshalJSON

func (p *Product) MarshalJSON() ([]byte, error)

func (*Product) Sanitize

func (p *Product) Sanitize()

func (*Product) UnmarshalJSON

func (p *Product) UnmarshalJSON(bytes []byte) error

type ProductID

type ProductID struct {
	ProductID uint64 `json:"product_id"`
}

func (ProductID) MarshalEasyJSON

func (v ProductID) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProductID) MarshalJSON

func (v ProductID) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProductID) UnmarshalEasyJSON

func (v *ProductID) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProductID) UnmarshalJSON

func (v *ProductID) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type ProductInFeed

type ProductInFeed struct {
	ID    uint64 `json:"id"              valid:"required"`
	Title string `` //nolint:nolintlint
	/* 143-byte string literal not displayed */
	Price          uint64  `json:"price"           valid:"required"`
	CityID         uint64  `json:"city_id"         valid:"required"`
	AvailableCount uint32  `json:"available_count" valid:"required"`
	Delivery       bool    `json:"delivery"        valid:"optional"`
	SafeDeal       bool    `json:"safe_deal"       valid:"optional"`
	InFavourites   bool    `json:"in_favourites"   valid:"optional"`
	IsActive       bool    `json:"is_active"       valid:"optional"`
	Premium        bool    `json:"premium"         valid:"required"`
	Images         []Image `json:"images"`
	Favourites     uint64  `json:"favourites"      valid:"required"`
}

func (ProductInFeed) MarshalEasyJSON

func (v ProductInFeed) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (ProductInFeed) MarshalJSON

func (v ProductInFeed) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*ProductInFeed) Sanitize

func (p *ProductInFeed) Sanitize()

func (*ProductInFeed) UnmarshalEasyJSON

func (v *ProductInFeed) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*ProductInFeed) UnmarshalJSON

func (v *ProductInFeed) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type User

type User struct {
	ID    uint64         `json:"id"                valid:"required"`
	Email string         `json:"email_with_rus"    valid:"required,email_with_rus~Некорректный формат email"` //nolint
	Phone sql.NullString ``                                                                                   //nolint
	/* 307-byte string literal not displayed */
	Name sql.NullString `` //nolint
	/* 194-byte string literal not displayed */
	Password string         `json:"password"          valid:"required,password~Пароль должен быть минимум 6 символов"`
	Birthday sql.NullTime   `json:"birthday"`
	Avatar   sql.NullString `json:"avatar"`
}

type UserWithoutID

type UserWithoutID struct {
	Email string         `json:"email_with_rus" valid:"required,email_with_rus~Некорректный формат email"` //nolint
	Phone sql.NullString ``                                                                                //nolint
	/* 304-byte string literal not displayed */
	Name sql.NullString `` //nolint
	/* 191-byte string literal not displayed */
	Password string         `json:"password"       valid:"required,password~Пароль должен быть минимум 6 символов"`
	Birthday sql.NullTime   `json:"birthday"`
	Avatar   sql.NullString `json:"avatar"`
}

func (UserWithoutID) MarshalEasyJSON

func (v UserWithoutID) MarshalEasyJSON(w *jwriter.Writer)

MarshalEasyJSON supports easyjson.Marshaler interface

func (UserWithoutID) MarshalJSON

func (v UserWithoutID) MarshalJSON() ([]byte, error)

MarshalJSON supports json.Marshaler interface

func (*UserWithoutID) Trim

func (u *UserWithoutID) Trim()

func (*UserWithoutID) UnmarshalEasyJSON

func (v *UserWithoutID) UnmarshalEasyJSON(l *jlexer.Lexer)

UnmarshalEasyJSON supports easyjson.Unmarshaler interface

func (*UserWithoutID) UnmarshalJSON

func (v *UserWithoutID) UnmarshalJSON(data []byte) error

UnmarshalJSON supports json.Unmarshaler interface

type UserWithoutPassword

type UserWithoutPassword struct {
	ID        uint64          `json:"id"                  valid:"required"`
	Email     string          `json:"email_with_rus"      valid:"required,email_with_rus~Некорректный формат email"` //nolint
	AvgRating sql.NullFloat64 `json:"avg_rating"          valid:"range(1|5)"`
	Phone     sql.NullString  `` //nolint
	/* 333-byte string literal not displayed */
	Name sql.NullString `` //nolint
	/* 219-byte string literal not displayed */
	Birthday  sql.NullTime   `json:"birthday"            swaggertype:"string"   example:"2014-12-12T14:00:12+07:00"`
	Avatar    sql.NullString `json:"avatar"              swaggertype:"string"`
	CreatedAt time.Time      `json:"created_at"          valid:"required"`
}

func (*UserWithoutPassword) MarshalJSON

func (u *UserWithoutPassword) MarshalJSON() ([]byte, error)

func (*UserWithoutPassword) Sanitize

func (u *UserWithoutPassword) Sanitize()

func (*UserWithoutPassword) Trim

func (u *UserWithoutPassword) Trim()

func (*UserWithoutPassword) UnmarshalJSON

func (u *UserWithoutPassword) UnmarshalJSON(bytes []byte) error

Jump to

Keyboard shortcuts

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