mysql

package
v0.0.0-...-54d6317 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2019 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 DB

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

DB is an INCOMPLETE implementation of a mySQL driver

func New

func New(log *logrus.Logger, dsn string) (*DB, error)

New returns a new mysql connection for the given DSN

func (*DB) AddPet

func (db *DB) AddPet(ctx context.Context, pet *pb.Pet) error

AddPet adds a pet to the database, unless it already exists or is invalid

func (*DB) DeletePet

func (db *DB) DeletePet(ctx context.Context, id int64) error

DeletePet deletes a pet

func (*DB) FindPetsByStatus

func (db *DB) FindPetsByStatus(ctx context.Context, statuses []string) (*pb.Pets, error)

FindPetsByStatus returns a list of pets that match any of the given status codes

func (*DB) GetPetByID

func (db *DB) GetPetByID(ctx context.Context, id int64) (*pb.Pet, error)

GetPetByID returns the pet by the given ID, or nil + error if not found

func (*DB) UpdatePet

func (db *DB) UpdatePet(ctx context.Context, pet *pb.Pet) error

UpdatePet to the new contents

func (*DB) UpdatePetWithForm

func (db *DB) UpdatePetWithForm(ctx context.Context, id int64, name string, status string) error

UpdatePetWithForm updates the name and status of a pet

func (*DB) UploadFile

func (db *DB) UploadFile(ctx context.Context, id int64, filename string) error

UploadFile records the uploaded file against the pet

Jump to

Keyboard shortcuts

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