entity

package
v0.0.0-...-c953c3f Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Follower

type Follower struct {
	UserID     string `json:"user_id" binding:"required"`
	FollowerID string `json:"follower_id" binding:"required"`
}

func TestFollower

func TestFollower(t *testing.T) *Follower

func (*Follower) Validate

func (u *Follower) Validate() error

type Order

type Order struct {
	ID     string `json:"id"`
	UserID string `json:"user_id" binding:"required"`
	Number int    `json:"number" binding:"required"`
}

func (*Order) Validate

func (m *Order) Validate() error

Validate ...

type OrderProduct

type OrderProduct struct {
	ID        int    `json:"id"`
	OrderID   string `json:"order_id"`
	ProductID string `json:"product_id"`
	Amount    int    `json:"amount"`
}

func (*OrderProduct) Validate

func (m *OrderProduct) Validate() error

type OrderProductView

type OrderProductView struct {
	ID     string `json:"id"`
	Amount int    `json:"amount"`
}

type Price

type Price struct {
	Currency string  `json:"currency" binding:"required"`
	Price    float64 `json:"price" binding:"required"`
}

func (*Price) Validate

func (m *Price) Validate() error

type Product

type Product struct {
	ID          string  `json:"id"`
	Name        string  `json:"name" binding:"required"`
	Description string  `json:"description"`
	LeftInStock int     `json:"left_in_stock" binding:"required"`
	Prices      []Price `json:"prices"`
}

func (*Product) Validate

func (m *Product) Validate() error

Validate ...

type ProductUpdateInput

type ProductUpdateInput struct {
	Name        *string `json:"name"`
	Description *string `json:"description"`
	LeftInStock *bool   `json:"left_in_stock"`
}

type Profile

type Profile struct {
	UserID     string `json:"user_id"`
	FirstName  string `json:"first_name" binding:"required"`
	LastName   string `json:"last_name" binding:"required"`
	MiddleName string `json:"middle_name"`
	FullName   string `json:"full_name"`
	Sex        string `json:"sex" binding:"required"`
	Age        int    `json:"age" binding:"required"`
}

func (*Profile) IsMan

func (u *Profile) IsMan() bool

func (*Profile) IsWoman

func (u *Profile) IsWoman() bool

func (*Profile) Validate

func (u *Profile) Validate() error

Validate ...

type User

type User struct {
	ID           string `json:"id"`
	Username     string `json:"username"`
	Password     string `json:"password"`
	PasswordHash string `json:"password_hash"`
}

func TestExistUser

func TestExistUser(t *testing.T) *User

func TestExistUser2

func TestExistUser2(t *testing.T) *User

func TestUser

func TestUser(t *testing.T) *User

func (*User) BeforeCreate

func (u *User) BeforeCreate(encryptor service.PasswordEncryptor) error

BeforeCreate ...

func (*User) ComparePassword

func (u *User) ComparePassword(password string, encryptor service.PasswordEncryptor) bool

ComparePassword ...

func (*User) Sanitize

func (u *User) Sanitize()

Sanitize ...

func (*User) Validate

func (u *User) Validate() error

Validate ...

Jump to

Keyboard shortcuts

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