db

package
v0.0.2-0...-6cd5c33 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Db

type Db interface {
	FindAll(model interface{}, loads []string) error
	FindById(model interface{}, id uint, loads []string) error
	Delete(model interface{}) error
	Create(model interface{}) error
	Update(model interface{}) error
}

type Postgres

type Postgres struct {
	// contains filtered or unexported fields
}

func CreatePostgres

func CreatePostgres(db *gorm.DB) *Postgres

func (Postgres) Create

func (p Postgres) Create(model interface{}) error

func (Postgres) Delete

func (p Postgres) Delete(model interface{}) error

func (Postgres) FindAll

func (p Postgres) FindAll(model interface{}, loads []string) error

func (Postgres) FindById

func (p Postgres) FindById(model interface{}, id uint, loads []string) error

func (Postgres) Update

func (p Postgres) Update(model interface{}) error

type Test

type Test struct {
	FindAllCount    int
	FindAllHandler  func(interface{}, []string) error
	FindByIdCount   int
	FindByIdHandler func(interface{}, uint, []string) error
	DeleteCount     int
	DeleteHandler   func(interface{}) error
	CreateCount     int
	CreateHandler   func(interface{}) error
	UpdateCount     int
	UpdateHandler   func(interface{}) error
}

func CreateTestDb

func CreateTestDb() *Test

func (*Test) Create

func (t *Test) Create(model interface{}) error

func (*Test) Delete

func (t *Test) Delete(model interface{}) error

func (*Test) FindAll

func (t *Test) FindAll(model interface{}, loads []string) error

func (*Test) FindById

func (t *Test) FindById(model interface{}, id uint, loads []string) error

func (*Test) Update

func (t *Test) Update(model interface{}) error

Jump to

Keyboard shortcuts

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