db

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2021 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Exit

func Exit(opts *cnf.Options) (err error)

Exit shuts down the connection with the data layer

func Export

func Export(fib *fibre.Context, ns, db string) (err error)

Export saves all database operations to a writer. This can be used to save a database snapshot to a secondary file or stream.

func Setup

func Setup(opts *cnf.Options) (err error)

Setup sets up the connection with the data layer

func Socket

func Socket(fib *fibre.Context, id string) (beg, end func())

Socket registers a websocket for live queries returning two callback functions. The first function should be called when the websocket connects, and the second function should be called when the websocket disconnects.

func Sync

func Sync(rw interface{}) (err error)

Import loads database operations from a reader. This can be used to playback a database snapshot into an already running database.

Types

type BlankError

type BlankError struct{}

BlankError represents an error that occured when switching access.

func (*BlankError) Error

func (e *BlankError) Error() string

Error returns the string representation of the error.

type Dispatch

type Dispatch struct {
	Query  string      `codec:"query,omitempty"`
	Action string      `codec:"action,omitempty"`
	Result interface{} `codec:"result,omitempty"`
}

Dispatch is a dispatch from the database

func (*Dispatch) CodecDecodeSelf

func (x *Dispatch) CodecDecodeSelf(d *codec1978.Decoder)

func (*Dispatch) CodecEncodeSelf

func (x *Dispatch) CodecEncodeSelf(e *codec1978.Encoder)

func (*Dispatch) IsCodecEmpty

func (x *Dispatch) IsCodecEmpty() bool

type ExistError

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

ExistError occurs when a record already exists.

func (*ExistError) Error

func (e *ExistError) Error() string

Error returns the string representation of the error.

type FieldError

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

FieldError occurs when a field does not conform to the specified assertion.

func (*FieldError) Error

func (e *FieldError) Error() string

Error returns the string representation of the error.

type IndexError

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

IndexError occurs when an index value is unable to be written.

func (*IndexError) Error

func (e *IndexError) Error() string

Error returns the string representation of the error.

type LimitError

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

LimitError occurs when a 'limit' expression is invalid.

func (*LimitError) Error

func (e *LimitError) Error() string

Error returns the string representation of the error.

type LiveError

type LiveError struct{}

LiveError occurs when a query can not be run.

func (*LiveError) Error

func (e *LiveError) Error() string

Error returns the string representation of the error.

type PermsError

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

PermsError occurs when a table query is not allowed.

func (*PermsError) Error

func (e *PermsError) Error() string

Error returns the string representation of the error.

type QueryError

type QueryError struct{}

QueryError represents an error that occured when switching access.

func (*QueryError) Error

func (e *QueryError) Error() string

Error returns the string representation of the error.

type Response

type Response struct {
	Time   string        `codec:"time,omitempty"`
	Status string        `codec:"status,omitempty"`
	Detail string        `codec:"detail,omitempty"`
	Result []interface{} `codec:"result,omitempty"`
}

Response is a response from the database

func Execute

func Execute(fib *fibre.Context, txt interface{}, vars map[string]interface{}) (out []*Response, err error)

Execute parses a single sql query, or multiple sql queries, and executes them serially against the underlying data layer.

func Process

func Process(fib *fibre.Context, ast *sql.Query, vars map[string]interface{}) (out []*Response, err error)

Process takes a parsed set of sql queries and executes them serially against the underlying data layer.

func (*Response) CodecDecodeSelf

func (x *Response) CodecDecodeSelf(d *codec1978.Decoder)

func (*Response) CodecEncodeSelf

func (x *Response) CodecEncodeSelf(e *codec1978.Encoder)

func (*Response) IsCodecEmpty

func (x *Response) IsCodecEmpty() bool

type StartError

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

StartError occurs when a 'start' expression is invalid.

func (*StartError) Error

func (e *StartError) Error() string

Error returns the string representation of the error.

type TableError

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

TableError occurs when an table value is unable to be written.

func (*TableError) Error

func (e *TableError) Error() string

Error returns the string representation of the error.

type TimerError

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

TimerError occurs when a query times out.

func (*TimerError) Error

func (e *TimerError) Error() string

Error returns the string representation of the error.

type VersnError

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

VersnError occurs when a 'version' expression is invalid.

func (*VersnError) Error

func (e *VersnError) Error() string

Error returns the string representation of the error.

Jump to

Keyboard shortcuts

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