entities

package
v0.0.0-...-a655b0a Latest Latest
Warning

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

Go to latest
Published: Jul 13, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	InternalError     = errors.New("Internal Server Error")
	ParamInvalid      = errors.New("Params Is Invalid")
	MethodNotAllowErr = errors.New("Method Not Allow")
)

Functions

This section is empty.

Types

type JSONSerializer

type JSONSerializer struct {
}

func (*JSONSerializer) Scan

func (j *JSONSerializer) Scan(
	ctx context.Context,
	field *schema.Field,
	dst reflect.Value,
	dbValue interface{},
) (err error)

func (*JSONSerializer) Value

func (j *JSONSerializer) Value(
	ctx context.Context,
	field *schema.Field,
	dst reflect.Value,
	fieldValue interface{},
) (interface{}, error)

type Order

type Order struct {
	Id              int         `json:"id,omitempty"`
	NumProducts     int         `json:"num_products,omitempty"`
	Money           float64     `json:"money,omitempty"`
	ShippingAddress string      `json:"shipping_address,omitempty"`
	Status          OrderStatus `json:"status,omitempty"`
}

func (*Order) TableName

func (o *Order) TableName() string

type OrderStatus

type OrderStatus int
const (
	PeddingStatus    OrderStatus = 1
	SuccessfulStatus OrderStatus = 2
	FailedStatus     OrderStatus = 3
)

type Product

type Product struct {
	ID         int64       `json:"id,omitempty"`
	Title      string      `json:"title,omitempty"`
	Properties *Properties `json:"properties,omitempty" gorm:"serializer:json"`
}

func (*Product) TablelName

func (p *Product) TablelName() string

type Properties

type Properties struct {
	Color    string  `json:"color,omitempty"`
	Price    float64 `json:"price,omitempty"`
	Category string  `json:"category,omitempty"`
}

Jump to

Keyboard shortcuts

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