database

package
v0.10.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2020 License: Unlicense Imports: 18 Imported by: 0

Documentation

Overview

Package database is an abstraction layer for database systems

Index

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) Collection added in v0.10.0

func (c *Collection) Collection(model interface{}) *Collection

func (*Collection) CustomCollection added in v0.10.0

func (c *Collection) CustomCollection(name string) *Collection

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) SelectSimple added in v0.10.0

func (c *Collection) SelectSimple(arguments interface{}) (interface{}, error)

func (*Collection) SelectSimpleAdvanced added in v0.10.0

func (c *Collection) SelectSimpleAdvanced(model interface{}, query *dbdefs.SelectQuery) error

func (*Collection) SelectSimpleInto added in v0.10.0

func (c *Collection) SelectSimpleInto(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

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 PlugCustom added in v0.10.0

func PlugCustom(
	adapter dbdefs.Adapter, config *dbsystem.DBAdapterConfig,
	schemaSyncOptions dbdefs.SchemaSyncOptions, models ...interface{}) *Database

func (*Database) Close added in v0.3.1

func (db *Database) Close() error

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

func (db *Database) IsTypeRelation(modelType reflect.Type, field reflect.StructField) bool

func (*Database) Prepare added in v0.3.1

func (db *Database) Prepare() error

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            func(txC *Collection) *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 RelationSolveContext struct {
	Relation              *Relation
	ModelCollection       *Collection
	TransactionCollection *Collection
	FieldValue            *reflect.Value
	ModelValue            *reflect.Value
	ForInsert             bool
	OnFinishRunners       []onFinishRunner

	LinkedToFieldInsideFieldValue *reflect.Value
	LinkedResult                  interface{}
}

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 TypeName added in v0.4.0

type TypeName = string

type TypeRelationsMap added in v0.4.0

type TypeRelationsMap map[TypeName]StructFieldRelationMap

Directories

Path Synopsis
Package dbdefs has common definitions of types that are related to the database abstraction layer and database management
Package dbdefs has common definitions of types that are related to the database abstraction layer and database management
Package dbsystem revolves around database system management, abstraction and registration
Package dbsystem revolves around database system management, abstraction and registration
autoregister
Package autoregister is solely used to import database systems with side-effects.
Package autoregister is solely used to import database systems with side-effects.
Package relationtype has all the relation types that can be used with this ORM
Package relationtype has all the relation types that can be used with this ORM

Jump to

Keyboard shortcuts

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