database

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 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) 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) 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            *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
	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

Jump to

Keyboard shortcuts

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