models

package
v0.0.0-...-308311b Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2023 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 Account

type Account struct {
	ID            uuid.UUID `gorm:"primaryKey;not null;unique" db:"id" json:"id" validate:"required,uuid"`
	CreatedAt     time.Time `gorm:"not null" db:"created_at" json:"created_at"`
	UpdatedAt     time.Time `gorm:"not null" db:"updated_at" json:"updated_at"`
	Disabled      bool      `gorm:"notn ull" db:"postalCode" json:"postalCode" validate:"required,lte=9"` // checked before all action on the account if true can do nothing
	Type          int       `gorm:"not null" db:"type" json:"type" validate:"required,lte=25"`
	BankAccountID string    `gorm:"not null" db:"bank_account_id" json:"bank_account_id" validate:"required,email,lte=25"`
	UserId        string    `gorm:"not null" db:"user_id" json:"user_id" validate:"required,lte=50"`
	Country       string    `gorm:"not null" db:"country" json:"country" validate:"required,lte=80"`
	// paramater credit, max spending ...
	Balance float32 `gorm:"not null" db:"city" json:"city" validate:"required,lte=35"`
}

Customer struct to describe User object.

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 Customer

type Customer struct {
	ID          uuid.UUID `gorm:"primaryKey;not null;unique" db:"id" json:"id" validate:"required,uuid"`
	CreatedAt   time.Time `gorm:"not null" db:"created_at" json:"created_at"`
	UpdatedAt   time.Time `gorm:"not null" db:"updated_at" json:"updated_at"`
	FirstName   string    `gorm:"not null" db:"firstName" json:"firstName" validate:"required,lte=25"`
	LastName    string    `gorm:"not null" db:"lastName" json:"lastName" validate:"required,email,lte=25"`
	DOB         time.Time `gorm:"not null" db:"dob" json:"dob" validate:"required,lte=50"`
	Address     string    `gorm:"not null" db:"address" json:"address" validate:"required,lte=80"`
	City        string    `gorm:"not null" db:"city" json:"city" validate:"required,lte=35"`
	PostalCode  int       `gorm:"notn ull" db:"postalCode" json:"postalCode" validate:"required,lte=9"`
	NumberPhone int       `gorm:"not null" db:"number_phone" json:"number_phone" validate:"required,lte=15"`
}

Customer struct to describe User object.

type Renew

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

Renew struct to describe refresh token object.

type SignIn

type SignIn struct {
	Username string `json:"username" validate:"required,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"`
	Username string `json:"username" validate:"required,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 `gorm:"primaryKey;not null;unique" db:"id" json:"id" validate:"required,uuid"`
	CreatedAt    time.Time `gorm:"not null" db:"created_at" json:"created_at"`
	UpdatedAt    time.Time `gorm:"not null" db:"updated_at" json:"updated_at"`
	Username     string    `gorm:"not null;unique" db:"username" json:"username" validate:"required,lte=25"`
	Email        string    `gorm:"not null;unique" db:"email" json:"email" validate:"required,email,lte=255"`
	PasswordHash string    `gorm:"not null" db:"password_hash" json:"password_hash" validate:"required,lte=255"`
	UserRole     string    `gorm:"not null" db:"user_role" json:"user_role" `
	Disabled     bool      `gorm:"not null,default:false"`
}

User struct to describe User object.

Jump to

Keyboard shortcuts

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