Documentation
¶
Overview ¶
Package database is an abstraction layer for database systems
Index ¶
- type Adapter
- type Database
- func (db *Database) Close() error
- func (db *Database) DataFromDatabaseUsingResolveParams(objArr interface{}, modelType reflect.Type, p graphql.ResolveParams) error
- func (db *Database) Delete(obj interface{}) error
- func (db *Database) Insert(obj interface{}) error
- func (db *Database) Prepare() error
- func (db *Database) Update(obj interface{}) error
- type SchemaSyncOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface {
SyncSchema(options SchemaSyncOptions, models ...interface{}) error
Close() error
Insert(obj interface{}) error
Update(obj interface{}) error
Delete(obj interface{}) error
DataFromDatabaseUsingResolveParams(objArr interface{}, modelType reflect.Type, p graphql.ResolveParams) error
}
Use this interface to implement a database interface This will be used by the abstraction layer
type Database ¶ added in v0.3.1
type Database struct {
// contains filtered or unexported fields
}
func Get ¶ added in v0.3.1
func Get(adapter Adapter, schemaSyncOptions SchemaSyncOptions, models ...interface{}) *Database
func (*Database) DataFromDatabaseUsingResolveParams ¶ added in v0.3.1
type SchemaSyncOptions ¶
type SchemaSyncOptions struct {
// Whether to remove columns from the database
// that can't be found in models.
//
// *This is a potentially destructive option, only
// enable if you're absolutely sure you want to remove
// old columns*
//
// Note that this may not have an effect on document
// or graph databases.
RemoveOrphanedColumns bool
}
Click to show internal directories.
Click to hide internal directories.