Documentation ¶
Index ¶
- Constants
- Variables
- func ApplySchemata(fileOrDirPath string, db Backend) error
- func Dir(useLocal bool, name string) http.FileSystem
- func FS(useLocal bool) http.FileSystem
- func FSByte(useLocal bool, name string) ([]byte, error)
- func FSMustByte(useLocal bool, name string) []byte
- func FSMustString(useLocal bool, name string) string
- func FSString(useLocal bool, name string) (string, error)
- func LoadFixtures(fileOrDirPath string, db Backend) error
- func LoadFixturesFromFile(filename string, db Backend) error
- func LoadSchemata(fileOrDirPaths ...string) ([]*dal.Collection, error)
- func LoadSchemataFromFile(filename string) ([]*dal.Collection, error)
- func MustGetCollection(db Backend, name string) *dal.Collection
- type Backend
- type Collection
- type Configuration
- type ConnectOptions
- type DB
- type Filter
- type Model
- type Record
- type RecordSet
Constants ¶
const ApplicationName = `pivot`
const ApplicationSummary = `an extensible database abstraction service`
const ApplicationVersion = `3.3.18`
Variables ¶
var MonitorCheckInterval = time.Duration(10) * time.Second
var NetrcFile = ``
Functions ¶
func ApplySchemata ¶
Creates all non-existent schemata in the given directory.
func Dir ¶
func Dir(useLocal bool, name string) http.FileSystem
Dir returns a http.Filesystem for the embedded assets on a given prefix dir. If useLocal is true, the filesystem's contents are instead used.
func FS ¶
func FS(useLocal bool) http.FileSystem
FS returns a http.Filesystem for the embedded assets. If useLocal is true, the filesystem's contents are instead used.
func FSByte ¶
FSByte returns the named file from the embedded assets. If useLocal is true, the filesystem's contents are instead used.
func FSMustByte ¶
FSMustByte is the same as FSByte, but panics if name is not present.
func FSMustString ¶
FSMustString is the string version of FSMustByte.
func LoadFixtures ¶
Calls LoadFixturesFromFile from all *.json files in the given directory.
func LoadFixturesFromFile ¶
Loads a JSON-encoded array of dal.Record objects from a file into the given DB backend instance.
func LoadSchemata ¶
func LoadSchemata(fileOrDirPaths ...string) ([]*dal.Collection, error)
Calls LoadSchemataFromFile from all *.json files in the given directory.
func LoadSchemataFromFile ¶
func LoadSchemataFromFile(filename string) ([]*dal.Collection, error)
Loads and registers a JSON-encoded array of dal.Collection objects into the given DB backend instance.
func MustGetCollection ¶
func MustGetCollection(db Backend, name string) *dal.Collection
A panicky version of backends.Backend.GetCollection
Types ¶
type Collection ¶
type Collection = dal.Collection
type Configuration ¶
type Configuration struct { Backend string `json:"backend"` Indexer string `json:"indexer"` Autoexpand bool `json:"autoexpand"` AutocreateCollections bool `json:"autocreate"` Environments map[string]Configuration `json:"environments"` }
func LoadConfigFile ¶
func LoadConfigFile(path string) (Configuration, error)
func (*Configuration) ForEnv ¶
func (self *Configuration) ForEnv(env string) Configuration
type ConnectOptions ¶
type ConnectOptions = backends.ConnectOptions
type DB ¶
type DB interface { backends.Backend AttachCollection(*Collection) Model C(string) *Collection Migrate(context.Context) error Models() []Model ApplySchemata(fileOrDirPath string) error LoadFixtures(fileOrDirPath string) error GetBackend() Backend SetBackend(Backend) }
func NewDatabase ¶
Create a new database connection with the default options.
func NewDatabaseWithOptions ¶
func NewDatabaseWithOptions(connection string, options ConnectOptions) (DB, error)
Create a new database connection with the given options.