zo

package module
v0.0.0-...-3670298 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Routes map[myrouter.RouteKey]func(w http.ResponseWriter, r *http.Request, ps common.QueryMap) = map[myrouter.RouteKey]func(w http.ResponseWriter, r *http.Request, ps common.QueryMap){
	{Path: "/api/v1/zos", Method: "GET", NeedAuth: true}:           zc.getAll,
	{Path: "/api/v1/zos/:zo_id", Method: "GET", NeedAuth: true}:    zc.get,
	{Path: "/api/v1/zos", Method: "POST", NeedAuth: true}:          zc.post,
	{Path: "/api/v1/zos/:zo_id", Method: "PUT", NeedAuth: true}:    zc.update,
	{Path: "/api/v1/zos/:zo_id", Method: "DELETE", NeedAuth: true}: zc.delete,
}

Functions

This section is empty.

Types

type DeleteResponse

type DeleteResponse struct {
	myhttp.ResponseBase
}

type GetAllResponse

type GetAllResponse struct {
	myhttp.ResponseBase
	Zos []Zo `json:"zos"`
}

type GetResponse

type GetResponse struct {
	myhttp.ResponseBase
	Zo *Zo `json:"zo"`
}

type PostResponse

type PostResponse struct {
	myhttp.ResponseBase
	Zo *Zo `json:"zo"`
}

type PutResponse

type PutResponse struct {
	myhttp.ResponseBase
	Zo *Zo `json:"zo"`
}

type Zo

type Zo struct {
	Id              int          `json:"id"`
	AchievementDate time.Time    `json:"achievementdate"`
	Exp             int          `json:"exp"`
	CategoryId      int          `json:"categoryid"`
	Message         string       `json:"message"`
	CreatedAt       time.Time    `json:"createdat"`
	UpdatedAt       sql.NullTime `json:"updatedat"`
	UserId          int          `json:"user_id"`
}

func NewZo

func NewZo(
	id int,
	achievementDate time.Time,
	exp int,
	categoryId int,
	message string,
	createdAt time.Time,
	updatedAt sql.NullTime,
	userId int,
) Zo

type ZoRepository

type ZoRepository struct {
}

func (*ZoRepository) Create

func (r *ZoRepository) Create(ctx context.Context, z *Zo) (int, error)

func (*ZoRepository) CreateTx

func (r *ZoRepository) CreateTx(ctx context.Context, tx *sql.Tx, z *Zo) (int, error)

func (*ZoRepository) Delete

func (r *ZoRepository) Delete(ctx context.Context, id int) error

func (*ZoRepository) Find

func (r *ZoRepository) Find(ctx context.Context, id int) (*Zo, error)

func (*ZoRepository) FindAll

func (r *ZoRepository) FindAll(ctx context.Context) ([]Zo, error)

func (*ZoRepository) Update

func (r *ZoRepository) Update(ctx context.Context, z *Zo) error

type ZoService

type ZoService struct {
	Zr ZoRepository
}

func (*ZoService) Delete

func (s *ZoService) Delete(ctx context.Context, id int) error

func (*ZoService) Get

func (s *ZoService) Get(ctx context.Context, id int) (*Zo, error)

func (*ZoService) GetAll

func (s *ZoService) GetAll(ctx context.Context) ([]Zo, error)

func (*ZoService) Post

func (s *ZoService) Post(ctx context.Context, z *Zo) (int, error)

func (*ZoService) Update

func (s *ZoService) Update(ctx context.Context, z *Zo) error

Jump to

Keyboard shortcuts

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