Documentation
¶
Overview ¶
Package database is an abstraction layer for database systems
Index ¶
- Constants
- type Collection
- func (c *Collection) DataFromDatabaseUsingResolveParams(objArr interface{}, modelType reflect.Type, p graphql.ResolveParams) error
- func (c *Collection) Delete(obj interface{}) error
- func (c *Collection) EnsureInTx() error
- func (c *Collection) Insert(obj interface{}) error
- func (c *Collection) IsInTx() bool
- func (c *Collection) RunInTransaction(fn TransactionFunc) error
- func (c *Collection) Select(arguments interface{}) (interface{}, error)
- func (c *Collection) SelectAdvanced(model interface{}, query *dbdefs.SelectQuery) error
- func (c *Collection) SelectInto(arguments interface{}, model interface{}) error
- func (c *Collection) Update(obj interface{}) error
- func (c *Collection) UpdateSpecifiedFields(obj interface{}, fields []reflect.StructField) error
- func (c *Collection) WithoutTx() *Collection
- type Database
- func (db *Database) Close() error
- func (db *Database) Collection(model interface{}) *Collection
- func (db *Database) CustomCollection(name string) *Collection
- func (db *Database) IsRelation(model interface{}, field reflect.StructField) bool
- func (db *Database) IsTypeRelation(modelType reflect.Type, field reflect.StructField) bool
- func (db *Database) Prepare() error
- type Relation
- type RelationSolveContext
- type StructFieldName
- type StructFieldRelationMap
- type TransactionFunc
- type TypeName
- type TypeRelationsMap
Constants ¶
View Source
const ( TagPrefix = "goqlorm.relation." TagRelationType = TagPrefix + "type" TagLinkTo = TagPrefix + "linkTo" TagLinkFrom = TagPrefix + "linkFrom" TagInversedBy = TagPrefix + "inversedBy" )
Tags
View Source
const (
AssocFieldPrefix = "Assoc"
)
View Source
const (
ErrorMustBeInTx = "can't do %s, mutations must be run in a transaction"
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Collection ¶ added in v0.4.0
type Collection struct { Name string // contains filtered or unexported fields }
func (*Collection) DataFromDatabaseUsingResolveParams ¶ added in v0.5.3
func (c *Collection) DataFromDatabaseUsingResolveParams( objArr interface{}, modelType reflect.Type, p graphql.ResolveParams) error
func (*Collection) Delete ¶ added in v0.5.1
func (c *Collection) Delete(obj interface{}) error
func (*Collection) EnsureInTx ¶ added in v0.6.2
func (c *Collection) EnsureInTx() error
func (*Collection) Insert ¶ added in v0.5.1
func (c *Collection) Insert(obj interface{}) error
func (*Collection) IsInTx ¶ added in v0.6.2
func (c *Collection) IsInTx() bool
func (*Collection) RunInTransaction ¶ added in v0.5.1
func (c *Collection) RunInTransaction(fn TransactionFunc) error
func (*Collection) Select ¶ added in v0.4.0
func (c *Collection) Select(arguments interface{}) (interface{}, error)
func (*Collection) SelectAdvanced ¶ added in v0.5.1
func (c *Collection) SelectAdvanced(model interface{}, query *dbdefs.SelectQuery) error
func (*Collection) SelectInto ¶ added in v0.5.1
func (c *Collection) SelectInto(arguments interface{}, model interface{}) error
func (*Collection) Update ¶ added in v0.5.1
func (c *Collection) Update(obj interface{}) error
func (*Collection) UpdateSpecifiedFields ¶ added in v0.9.0
func (c *Collection) UpdateSpecifiedFields(obj interface{}, fields []reflect.StructField) error
func (*Collection) WithoutTx ¶ added in v0.6.0
func (c *Collection) WithoutTx() *Collection
type Database ¶ added in v0.3.1
type Database struct {
// contains filtered or unexported fields
}
func Plug ¶ added in v0.7.1
func Plug( system dbsystem.DBSystem, config *dbsystem.DBAdapterConfig, schemaSyncOptions dbdefs.SchemaSyncOptions, models ...interface{}) *Database
func (*Database) Collection ¶ added in v0.4.0
func (db *Database) Collection(model interface{}) *Collection
func (*Database) CustomCollection ¶ added in v0.5.1
func (db *Database) CustomCollection(name string) *Collection
func (*Database) IsRelation ¶ added in v0.6.3
func (db *Database) IsRelation(model interface{}, field reflect.StructField) bool
func (*Database) IsTypeRelation ¶ added in v0.6.3
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 Associations *Collection AssociateFrom reflect.StructField AssociateTo reflect.StructField AssociationType reflect.Type Type relationtype.RelationType InversedBy *reflect.StructField AssociationEntryIdField reflect.StructField LinkedPrimaryKeyField reflect.StructField }
type RelationSolveContext ¶ added in v0.6.0
type StructFieldName ¶ added in v0.4.0
type StructFieldName = string
type StructFieldRelationMap ¶ added in v0.4.0
type StructFieldRelationMap map[StructFieldName]*Relation
type TransactionFunc ¶ added in v0.4.2
type TransactionFunc func(txDb *Collection) error
type TypeRelationsMap ¶ added in v0.4.0
type TypeRelationsMap map[TypeName]StructFieldRelationMap
Click to show internal directories.
Click to hide internal directories.