pet

package
v0.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 3, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Pet

type Pet struct {
	ID          string                 `json:"id"`
	Title       string                 `json:"title"`
	Price       int32                  `json:"price"`
	FeatureTags []string               `json:"feature_tags"`
	Attrs       map[string]interface{} `json:"attrs"`
	CreatedAt   time.Time              `json:"created_at"`
	UpdatedAt   time.Time              `json:"updated_at"`
	Ver         int32                  `json:"ver"`
}

Pet is the pet model

type Repository

type Repository struct {
	*dbc.Psql
}

Repository is the data access object for pet

func (*Repository) DeleteAll

func (r *Repository) DeleteAll(ctx context.Context) error

DeleteAll deletes all pets

func (*Repository) DeleteOne

func (r *Repository) DeleteOne(ctx context.Context, id string) error

DeleteOne deletes a pet by ID

func (*Repository) InsertOne

func (r *Repository) InsertOne(ctx context.Context, item *Pet) (*Pet, error)

InsertOne inserts a new pet

func (*Repository) SelectAll

func (r *Repository) SelectAll(ctx context.Context) ([]Pet, error)

SelectAll selects all pets

func (*Repository) SelectOne

func (r *Repository) SelectOne(ctx context.Context, id string) (*Pet, error)

SelectOne selects a pet by ID

func (*Repository) UpdateOne

func (r *Repository) UpdateOne(ctx context.Context, id string, title string) (*Pet, error)

UpdateOne updates a pet

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service is the pet service

func New

func New() *Service

New creates a new pet service

func (*Service) Create

func (s *Service) Create(ctx context.Context, item *Pet) (*Pet, error)

Create creates a new pet

func (*Service) Get

func (s *Service) Get(ctx context.Context, id string) (*Pet, error)

Get finds a pet by ID

func (*Service) List

func (s *Service) List(ctx context.Context) ([]Pet, error)

List finds all pets

func (*Service) Remove

func (s *Service) Remove(ctx context.Context, id string) error

Remove removes a pet

func (*Service) RemoveAll

func (s *Service) RemoveAll(ctx context.Context) error

Remove removes all pets

func (*Service) Update

func (s *Service) Update(ctx context.Context, id string, title string) (*Pet, error)

Update updates a pet

Jump to

Keyboard shortcuts

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