Documentation
¶
Overview ¶
Package database is an abstraction layer for database systems
Index ¶
- Constants
- type Adapter
- type Collection
- type Database
- func (db *Database) Close() error
- func (db *Database) Collection(model interface{}) *Collection
- 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 Relation
- type SchemaSyncOptions
- type StructFieldName
- type StructFieldRelationMap
- type TypeName
- type TypeRelationsMap
Constants ¶
View Source
const ( TagPrefix = "goqlorm.relation." TagRelationType = TagPrefix + "type" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface {
SyncSchema(options SchemaSyncOptions, models ...interface{}) error
Close() error
Select(collectionName string, args interface{}) (interface{}, 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 Collection ¶ added in v0.4.0
type Collection struct {
Name string
// contains filtered or unexported fields
}
func (*Collection) Select ¶ added in v0.4.0
func (c *Collection) Select(arguments interface{}) (interface{}, error)
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) Collection ¶ added in v0.4.0
func (db *Database) Collection(model interface{}) *Collection
func (*Database) DataFromDatabaseUsingResolveParams ¶ added in v0.3.1
type Relation ¶ added in v0.4.0
type Relation struct {
ModelType reflect.Type
Field reflect.StructField
LinkedType reflect.Type
LinkedTo reflect.StructField
LinkedFrom reflect.StructField
Type relationtype.RelationType
}
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
}
type StructFieldName ¶ added in v0.4.0
type StructFieldName = string
type StructFieldRelationMap ¶ added in v0.4.0
type StructFieldRelationMap map[StructFieldName]*Relation
type TypeRelationsMap ¶ added in v0.4.0
type TypeRelationsMap map[TypeName]StructFieldRelationMap
Click to show internal directories.
Click to hide internal directories.