backend

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2019 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Overview

Package backend defines a Backend that is responsible for communicating with SQL databases and other external systems

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrUnexpectedJSON         = errors.New("Received JSON data that we are unable to parse")
	ErrMismatchedAffectedRows = errors.New("The amount of rows affected should be sane")
	ErrNoLastInsertID         = errors.New("Database does not support getting the last inserted ID")
)

Functions

This section is empty.

Types

type Backend

type Backend struct {
	GetSchemaMappingFunc          func(string) *descriptor.SchemaMapping
	GetFilterPredicateMappingFunc func(filter.Predicate) string
	GetQueryTemplateFunc          func(string) string
	CoerceArgFuncs                map[string]func(map[string]interface{}, *descriptor.Field) (interface{}, bool, error)
	QueryFormatFuncs              map[string]func() string
	BackendFormattingFuncs        map[string]func(string) (string, error)
	CastBackendTypeToGolangType   func(string) interface{}
	QueryContextFunc              func(context.Context, string, ...interface{}) ([]interface{}, error)
	ExecContextFunc               func(context.Context, string, ...interface{}) (sql.Result, error)
	OpenFunc                      func(...interface{}) error
	CreateTxFunc                  func(time.Duration) (uuid.UUID, error)
	CommitTxFunc                  func(string) error
}

func (*Backend) CommitTransaction

func (b *Backend) CommitTransaction(rw http.ResponseWriter, req *http.Request)

func (*Backend) CommitTx

func (b *Backend) CommitTx(txUUID string) (err error)

func (*Backend) CreateSingle

func (b *Backend) CreateSingle(rw http.ResponseWriter, req *http.Request)

func (*Backend) CreateTransaction

func (b *Backend) CreateTransaction(rw http.ResponseWriter, req *http.Request)

func (*Backend) CreateTx

func (b *Backend) CreateTx(timeout time.Duration) (txUUID uuid.UUID, err error)

func (*Backend) DeleteSingle

func (b *Backend) DeleteSingle(rw http.ResponseWriter, req *http.Request)

func (*Backend) ExecContext

func (b *Backend) ExecContext(ctx context.Context, query string, args ...interface{}) (result sql.Result, err error)

func (*Backend) GetCoerceArgFuncs

func (b *Backend) GetCoerceArgFuncs() map[string]func(map[string]interface{}, *descriptor.Field) (interface{}, bool, error)

func (*Backend) GetCollection

func (b *Backend) GetCollection(rw http.ResponseWriter, req *http.Request)

func (*Backend) GetCollectionAsOptions

func (b *Backend) GetCollectionAsOptions(rw http.ResponseWriter, req *http.Request)

func (*Backend) GetCollectionAsOptionsFilterable

func (b *Backend) GetCollectionAsOptionsFilterable(rw http.ResponseWriter, req *http.Request)

func (*Backend) GetCollectionAsOptionsWithParams

func (b *Backend) GetCollectionAsOptionsWithParams(rw http.ResponseWriter, req *http.Request)

func (*Backend) GetCollectionFilterable

func (b *Backend) GetCollectionFilterable(rw http.ResponseWriter, req *http.Request)

func (*Backend) GetDescriptorFile

func (b *Backend) GetDescriptorFile(rw http.ResponseWriter, req *http.Request)

func (*Backend) GetFilterPredicateMapping

func (b *Backend) GetFilterPredicateMapping(predicate filter.Predicate) string

func (*Backend) GetHandler

func (b *Backend) GetHandler() http.Handler

func (*Backend) GetQueryFormatFuncs

func (b *Backend) GetQueryFormatFuncs() map[string]func() string

func (*Backend) GetQueryTemplate

func (b *Backend) GetQueryTemplate(name string) string

func (*Backend) GetSchemaMapping

func (b *Backend) GetSchemaMapping(typeDescriptor string) *descriptor.SchemaMapping

func (*Backend) GetSingle

func (b *Backend) GetSingle(rw http.ResponseWriter, req *http.Request)

func (*Backend) GetSingleAsOption

func (b *Backend) GetSingleAsOption(rw http.ResponseWriter, req *http.Request)

func (*Backend) Open

func (b *Backend) Open(args ...interface{}) error

Open a connection to the backend database

func (*Backend) QueryContext

func (b *Backend) QueryContext(ctx context.Context, query string, args ...interface{}) (results []interface{}, err error)

func (*Backend) UpdateSingle

func (b *Backend) UpdateSingle(rw http.ResponseWriter, req *http.Request)

Jump to

Keyboard shortcuts

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