repository

package
v0.0.0-...-44dcfa3 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewGormStorage

func NewGormStorage() gormStorage

NewGormStorage creates a new instance of gorm storage integration. Since gorm is thread safe (https://v1.gorm.io/docs/method_chaining.html) only one connection will be created. If more than one DB is used use a map for dsn.

func NewTaskQuery

func NewTaskQuery(querySize int) (*taskQuery, error)

NewTaskQuery Builds a new task query to be used on the storage interface. NOTE: THIS MUST BE REFACTORED TO USE THE OPTIONS PATTERN (https://www.sohamkamani.com/golang/options-pattern/)

func NewTaskRepo

func NewTaskRepo(storage Storage) *taskRepo

NewTaskRepo creates a new taskRepo instance. Storage is the db storage implementation that allows the interaction with the DB

Types

type Query

type Query struct {
	Field    string
	Operator string
	Value    interface{}
}

query represents a common way to perform queries on a storage

type QueryBuilder

type QueryBuilder interface {
	AddQuery(string, interface{}) (Query, error)
}

type Storage

type Storage interface {
	Migrate(interface{}) error
	Close()
	Get(uuid.UUID, interface{}) error
	Filter([]Query, interface{}, models.Pagination, ...string) error
	Create(interface{}) error
	Save(interface{}) error
	Delete(interface{}) error
}

Storage is the common interface to interact with the database

Jump to

Keyboard shortcuts

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