crud

package
v0.3.25 Latest Latest
Warning

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

Go to latest
Published: Sep 8, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AugmentableQuery

type AugmentableQuery *func(*goqu.SelectDataset) *goqu.SelectDataset

type Columns

type Columns []interface{}

type Direction

type Direction int
const (
	ASC Direction = iota
	DSC
)

type ExpressionFunc added in v0.3.25

type ExpressionFunc func(*goqu.SelectDataset, interface{}) *goqu.SelectDataset

type Expressions added in v0.3.25

type Expressions map[string]ExpressionFunc

type Filters

type Filters map[string]interface{}

func FiltersFromReq

func FiltersFromReq(req service.Req) Filters

type Model

type Model struct {
	MultiTenant      bool
	Paginate         bool
	Table            string
	Columns          []interface{}
	Expressions      Expressions
	AugmentListQuery AugmentableQuery
	AugmentOneQuery  AugmentableQuery
	// contains filtered or unexported fields
}

func (*Model) Create

func (m *Model) Create(params interface{}, destination interface{}) error

func (*Model) Delete

func (m *Model) Delete(id interface{}) error

func (*Model) Initialize

func (m *Model) Initialize(dialect string, cx sql.ConnX)

func (*Model) One

func (m *Model) One(destination interface{}, id interface{}) error

func (*Model) Page

func (m *Model) Page(items interface{}, filters Filters, order Order, page int, size int) (*service.ContentResponse, error)

func (*Model) PageFromReq

func (m *Model) PageFromReq(dest interface{}, req service.Req) (interface{}, error)

func (*Model) SetupCreateTest

func (m *Model) SetupCreateTest(
	t *testing.T,
	params interface{},
) func() error

func (*Model) SetupDeleteTest

func (m *Model) SetupDeleteTest(
	t *testing.T,
) func() error

func (*Model) SetupOneTest

func (m *Model) SetupOneTest(
	t *testing.T,
) func() error

func (*Model) SetupPageTest

func (m *Model) SetupPageTest(
	response interface{},
	filters Filters, order Order, page int, size int,
	responseHandler func(interface{}, string, ...interface{}) error,
)

func (*Model) SetupUpdateTest

func (m *Model) SetupUpdateTest(
	t *testing.T,
	params interface{},
	destination interface{},
) func() error

func (*Model) Update

func (m *Model) Update(id interface{}, params interface{}, destination interface{}) error

type Order

type Order []OrderColumn

func OrderFromReq

func OrderFromReq(req service.Req) Order

type OrderColumn

type OrderColumn struct {
	Name string
	Direction
}

type Page

type Page int

type Size

type Size int

Jump to

Keyboard shortcuts

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