database

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2020 License: Unlicense Imports: 7 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"
)

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) 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) DataFromDatabaseUsingResolveParams added in v0.3.1

func (db *Database) DataFromDatabaseUsingResolveParams(
	objArr interface{}, modelType reflect.Type, p graphql.ResolveParams) error

func (*Database) Delete added in v0.3.1

func (db *Database) Delete(obj interface{}) error

func (*Database) Insert added in v0.3.1

func (db *Database) Insert(obj interface{}) error

func (*Database) Prepare added in v0.3.1

func (db *Database) Prepare() error

func (*Database) Update added in v0.3.1

func (db *Database) Update(obj interface{}) 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
	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 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