model

package
v0.0.0-...-4dc1058 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Validate = validator.New(validator.WithRequiredStructEnabled())

Functions

This section is empty.

Types

type ProductCReq

type ProductCReq struct {
	Name  string `json:"name" validate:"required"`
	Price int64  `json:"price" validate:"gt=0"`
}

func (ProductCReq) ToRepo

type ProductUReq

type ProductUReq struct {
	Name  string `json:"name" validate:"required"`
	Price int64  `json:"price" validate:"gt=0"`
	ID    int32  `json:"-"`
}

func (ProductUReq) SetID

func (p ProductUReq) SetID(id int32) any

func (ProductUReq) ToRepo

type UserCReq

type UserCReq struct {
	Name  string `json:"name" validate:"required"`
	Email string `json:"email" validate:"required,email"`
}

func (UserCReq) ToRepo

func (p UserCReq) ToRepo() repo.CreateUserParams

type UserUReq

type UserUReq struct {
	Name  string `json:"name" validate:"required"`
	Email string `json:"email" validate:"required,email"`
	ID    int32  `json:"-"` // "-" means this field is not required alway leave it like this
}

func (UserUReq) SetID

func (p UserUReq) SetID(id int32) UserUReq

func (UserUReq) ToRepo

func (p UserUReq) ToRepo() repo.UpdateUserParams

Jump to

Keyboard shortcuts

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