sql

package
v0.1.0-beta.1 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrPostFormEmpty          = errors.New("Form data sent was either empty, incomplete or of an unsupported type")
	ErrCardinalityMany        = errors.New("Form data contained multiple input values for a single column")
	ErrUnexpectedJSON         = errors.New("Received JSON data that we are unable to parse")
	ErrMismatchedAffectedRows = errors.New("The amount of rows affected should be sane")
)

Functions

This section is empty.

Types

type Backend

type Backend struct {
	Cfg                       *config.Config
	ConvertDBSpecificDataType func(string) interface{}
	DB                        *sql.DB
	Queries                   map[string]string
	RequestData               map[string]interface{}
	Templates                 map[string]string
	// contains filtered or unexported fields
}

func NewBackend

func NewBackend(cfg *config.Config) (b *Backend)

NewBackend ...

func (*Backend) CreateSingle

func (b *Backend) CreateSingle(req *http.Request) (response []interface{}, err error)

Create data from database

func (*Backend) GetCollection

func (b *Backend) GetCollection(req *http.Request) (response []interface{}, err error)

func (*Backend) GetCollectionAsOptions

func (b *Backend) GetCollectionAsOptions(req *http.Request) (response []interface{}, err error)

Fetch Options from database

func (*Backend) GetCollectionAsOptionsFilterable

func (b *Backend) GetCollectionAsOptionsFilterable(req *http.Request) (response []interface{}, err error)

Fetch Options from database

func (*Backend) GetSingle

func (b *Backend) GetSingle(req *http.Request) (response []interface{}, err error)

Fetch data from database

func (*Backend) GetSingleAsOption

func (b *Backend) GetSingleAsOption(req *http.Request) (response []interface{}, err error)

Fetch Option data from database

func (*Backend) Open

func (b *Backend) Open(driver, url string) error

Open a connection to the backend database

func (*Backend) SaveTableSchemas

func (b *Backend) SaveTableSchemas() (err error)

insert context

func (*Backend) TearDown

func (b *Backend) TearDown()

Tear down any connections opened by the endpoint

func (*Backend) UpdateSingle

func (b *Backend) UpdateSingle(req *http.Request) (response []interface{}, err error)

Update data from database

type NullTime

type NullTime struct {
	Time  time.Time
	Valid bool // Valid is true if Time is not NULL
}

func (*NullTime) Scan

func (nt *NullTime) Scan(value interface{}) error

Scan implements the Scanner interface.

func (NullTime) Value

func (nt NullTime) Value() (driver.Value, error)

Value implements the driver Valuer interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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