database

package
v0.3.2 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2020 License: Unlicense Imports: 2 Imported by: 0

Documentation

Overview

Package database is an abstraction layer for database systems

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Adapter

type Adapter interface {
	SyncSchema(options SchemaSyncOptions, models ...interface{}) error
	Close() 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 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) 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 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
}

Jump to

Keyboard shortcuts

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