toyquery

package module
v0.0.0-...-34e475e Latest Latest
Warning

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

Go to latest
Published: Aug 12, 2019 License: MIT Imports: 4 Imported by: 0

README

toyquery

the coverage of test code is always 100%, isn't it?

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDatabaseNotFound :
	ErrDatabaseNotFound = DefineError(fmt.Errorf("database not found"))
	// ErrTableNotFound :
	ErrTableNotFound = DefineError(fmt.Errorf("table not found"))
	// ErrFieldNotFound :
	ErrFieldNotFound = DefineError(fmt.Errorf("field not found"))

	// ErrRecordNotFound :
	ErrRecordNotFound = DefineError(fmt.Errorf("record not found"))

	// ErrSomethingWrong :
	ErrSomethingWrong = DefineError(fmt.Errorf("something wrong")) // ???
	// ErrEmptyCondition :
	ErrEmptyCondition = DefineError(fmt.Errorf("empty condition")) // ???
	// ErrInvalidCondition :
	ErrInvalidCondition = DefineError(fmt.Errorf("invalid condition")) // ???
)

TODO: more gentle implementation

Functions

func Where

func Where(fmt string, vals ...interface{}) func(*QOption)

Where :

Types

type Client

type Client interface {
	io.Closer
	SessionFactory
}

Client :

type Error

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

Error :

func (*Error) Cause

func (e *Error) Cause() error

Cause :

func (*Error) Error

func (e *Error) Error() string

Error :

func (*Error) Reason

func (e *Error) Reason() error

Reason :

type ErrorFactory

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

ErrorFactory :

func DefineError

func DefineError(reason error) *ErrorFactory

DefineError :

func (*ErrorFactory) Error

func (f *ErrorFactory) Error() string

Error :

func (*ErrorFactory) New

func (f *ErrorFactory) New(msg string) error

New :

func (*ErrorFactory) Reason

func (f *ErrorFactory) Reason() error

Reason :

func (*ErrorFactory) Wrap

func (f *ErrorFactory) Wrap(err error, msg string) error

Wrap :

type ID

type ID = string

ID :

type QOption

type QOption struct {
	Wheres []QOptionItem
}

QOption :

type QOptionItem

type QOptionItem struct {
	Fmt  string
	Vals []interface{}
}

QOptionItem :

type Session

type Session interface {
	io.Closer
	Table(ctx context.Context, name string) (Table, error)
	Exec(ctx context.Context, code string) error
}

Session :

type SessionFactory

type SessionFactory interface {
	Session(ctx context.Context) (Session, error)
}

SessionFactory :

type Table

type Table interface {
	// TODO: add methods (tentative)
	GetByID(ctx context.Context, id ID, val interface{}) error
	Get(ctx context.Context, val interface{}, options ...func(*QOption)) error
	InsertByID(ctx context.Context, id ID, val interface{}) error
	Count(ctx context.Context, options ...func(*QOption)) (int, error)
}

Table :

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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