models

package
v0.0.0-...-7e87c26 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2022 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Book

type Book struct {
	ID         uuid.UUID `db:"id" json:"id" validate:"required,uuid"`
	CreatedAt  time.Time `db:"created_at" json:"created_at"`
	UpdatedAt  time.Time `db:"updated_at" json:"updated_at"`
	UserID     uuid.UUID `db:"user_id" json:"user_id" validate:"required,uuid"`
	Title      string    `db:"title" json:"title" validate:"required,lte=255"`
	Author     string    `db:"author" json:"author" validate:"required,lte=255"`
	BookStatus int       `db:"book_status" json:"book_status" validate:"required,len=1"`
	BookAttrs  BookAttrs `db:"book_attrs" json:"book_attrs" validate:"required,dive"`
}

Book struct to describe book object.

type BookAttrs

type BookAttrs struct {
	Picture     string `json:"picture"`
	Description string `json:"description"`
	Rating      int    `json:"rating" validate:"min=1,max=10"`
}

BookAttrs struct to describe book attributes.

func (*BookAttrs) Scan

func (b *BookAttrs) Scan(value interface{}) error

Scan make the BookAttrs struct implement the sql.Scanner interface. This method simply decodes a JSON-encoded value into the struct fields.

func (BookAttrs) Value

func (b BookAttrs) Value() (driver.Value, error)

Value make the BookAttrs struct implement the driver.Valuer interface. This method simply returns the JSON-encoded representation of the struct.

type Coin

type Coin struct {
	ID          uuid.UUID `db:"id" json:"id" validate:"required,uuid"`
	CreatedAt   time.Time `db:"created_at" json:"created_at"`
	UpdatedAt   time.Time `db:"updated_at" json:"updated_at"`
	ExchangeId  uuid.UUID `db:"exchange_id" json:"exchange_id" validate:"required,uuid"`
	Name        string    `db:"name" json:"name" validate:"required,gte=2,lte=25"`
	Code        string    `db:"code" json:"code" validate:"required,gte=2,lte=10"`
	Description string    `db:"description" json:"description" validate:"lte=255"`
	IsDeleted   bool      `db:"is_deleted" json:"is_deleted" validate:"required"`
	ImageUri    string    `db:"image_uri" json:"image_uri"`
	CoinUri     CoinUri   `db:"coin_uri" json:"coin_uri" validate:"required,dive"`
}

type CoinUri

type CoinUri struct {
	CoinID    uuid.UUID `db:"coin_id" json:"coin_id" validate:"required,uuid"`
	Uri       string    `db:"uri" json:"uri" validate:"required"`
	CreatedAt time.Time `db:"created_at" json:"created_at"`
	UpdatedAt time.Time `db:"updated_at" json:"updated_at"`
}

type Exchange

type Exchange struct {
	ID          uuid.UUID `db:"id" json:"id" validate:"required,uuid"`
	CreatedAt   time.Time `db:"created_at" json:"created_at"`
	UpdatedAt   time.Time `db:"updated_at" json:"updated_at"`
	Name        string    `db:"name" json:"name" validate:"required,lte=25"`
	Description string    `db:"description" json:"description" validate:"lte=255"`
	Uri         string    `db:"uri" json:"uri"`
	// Enable Crawling?
	IsEnabled bool `db:"is_enabled" json:"is_enabled"`
	// We got blocked?
	IsBlocked bool `db:"is_blocked" json:"is_blocked"`
	// Is Exchange gone?
	IsDeleted bool `db:"is_deleted" json:"is_deleted"`
}

type Renew

type Renew struct {
	RefreshToken string `json:"refresh_token"`
}

Renew struct to describe refresh token object.

type SignIn

type SignIn struct {
	Email    string `json:"email" validate:"required,email,lte=255"`
	Password string `json:"password" validate:"required,lte=255"`
}

SignIn struct to describe login user.

type SignUp

type SignUp struct {
	Email    string `json:"email" validate:"required,email,lte=255"`
	Password string `json:"password" validate:"required,lte=255"`
	UserRole string `json:"user_role" validate:"required,lte=25"`
}

SignUp struct to describe register a new user.

type User

type User struct {
	ID           uuid.UUID `db:"id" json:"id" validate:"required,uuid"`
	CreatedAt    time.Time `db:"created_at" json:"created_at"`
	UpdatedAt    time.Time `db:"updated_at" json:"updated_at"`
	Email        string    `db:"email" json:"email" validate:"required,email,lte=255"`
	PasswordHash string    `db:"password_hash" json:"password_hash,omitempty" validate:"required,lte=255"`
	UserStatus   int       `db:"user_status" json:"user_status" validate:"required,len=1"`
	UserRole     string    `db:"user_role" json:"user_role" validate:"required,lte=25"`
}

User struct to describe User object.

Jump to

Keyboard shortcuts

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