persistence

package
v0.0.0-...-b7effc6 Latest Latest
Warning

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

Go to latest
Published: Jan 14, 2018 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const OrgContextKey = "org"

Variables

View Source
var (
	ErrNotFound = errors.New("identified data not found")
)

Functions

func ExecDelete

func ExecDelete(ctx context.Context, database Database, query string, args ...interface{}) (int64, error)

func ExecInsert

func ExecInsert(ctx context.Context, database Database, query string, args ...interface{}) (int, error)

func GetEnvWithDefault

func GetEnvWithDefault(key, defaultValue string) string

func Migrate

func Migrate() error

Types

type Database

type Database interface {
	Exec(ctx context.Context, query string, args ...interface{}) (result sql.Result, err error)
	Query(ctx context.Context, query string, args ...interface{}) (rows *sql.Rows, err error)
	QueryRow(ctx context.Context, query string, args ...interface{}) (row *sql.Row)
	BeginTx(ctx context.Context) (database Database, err error)
	Commit() (err error)
	Rollback() (err error)
}

func Open

func Open() (Database, error)

type GarbanzoStore

type GarbanzoStore struct{}

func (GarbanzoStore) Create

func (GarbanzoStore) Create(ctx context.Context, database Database, garbanzo data.Garbanzo) (int, error)

func (GarbanzoStore) DeleteByAPIUUIDAndOctoName

func (GarbanzoStore) DeleteByAPIUUIDAndOctoName(ctx context.Context, database Database, apiUUID uuid.UUID, octoName string) error

func (GarbanzoStore) DeleteByOctoId

func (GarbanzoStore) DeleteByOctoId(ctx context.Context, database Database, octoId int) error

func (GarbanzoStore) FetchByAPIUUIDAndOctoName

func (GarbanzoStore) FetchByAPIUUIDAndOctoName(ctx context.Context, database Database, apiUUID uuid.UUID, octoName string) (data.Garbanzo, error)

func (GarbanzoStore) FetchByOctoName

func (GarbanzoStore) FetchByOctoName(ctx context.Context, database Database, octoName string) ([]data.Garbanzo, error)

type OctoStore

type OctoStore struct{}

func (OctoStore) Create

func (OctoStore) Create(ctx context.Context, database Database, octo data.Octo) (int, error)

func (OctoStore) DeleteById

func (OctoStore) DeleteById(ctx context.Context, database Database, id int) error

func (OctoStore) FetchAll

func (OctoStore) FetchAll(ctx context.Context, database Database) ([]data.Octo, error)

func (OctoStore) FetchByName

func (OctoStore) FetchByName(ctx context.Context, database Database, name string, selectForUpdate bool) (data.Octo, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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