app

package
v0.3.5 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2022 License: BSD-2-Clause Imports: 8 Imported by: 4

Documentation

Index

Constants

View Source
const NOT_DELETED int64 = 0

Variables

This section is empty.

Functions

func AddCriteria

func AddCriteria(conditions []*db.Criteria, column *db.Column, value *string) ([]*db.Criteria, bool)

func AddEqualCriteria

func AddEqualCriteria(conditions []*db.Criteria, column *db.Column, value interface{}) ([]*db.Criteria, bool)

func AddNoCaseCriteria

func AddNoCaseCriteria(conditions []*db.Criteria, column *db.Column, value *string) ([]*db.Criteria, bool)

func AddRangeCriteria

func AddRangeCriteria(conditions []*db.Criteria, column *db.Column, leftBound interface{}, rightBound interface{}) ([]*db.Criteria, bool)

func AddWildCriteria

func AddWildCriteria(conditions []*db.Criteria, column *db.Column, value *string) ([]*db.Criteria, bool)

func AddWildNoCaseCriteria

func AddWildNoCaseCriteria(conditions []*db.Criteria, column *db.Column, value *string) ([]*db.Criteria, bool)

func CopyBin

func CopyBin(value []byte) []byte

func CopyCurrency

func CopyCurrency(value *float64) *float64

func CopyDate

func CopyDate(value *Date) *Date

func CopyInteger

func CopyInteger(value *int64) *int64

func CopyString

func CopyString(value *string) *string

func Delete

func Delete(DB db.IDb, table *db.Table, entity IEntity) error

func DeleteById

func DeleteById(DB db.IDb, table *db.Table, id int64) (bool, error)

func DeleteByIdAndVersion

func DeleteByIdAndVersion(DB db.IDb, table *db.Table, id int64, version int64) error

func FindAll

func FindAll(DB db.IDb, table *db.Table, instance interface{}) (coll.Collection, error)

func FindAllWithDeleted

func FindAllWithDeleted(DB db.IDb, table *db.Table, instance interface{}) (coll.Collection, error)

func FindById

func FindById(DB db.IDb, table *db.Table, instance interface{}, id int64) (bool, error)

the result of the query is put in the passed struct. returns true if a result was found, false if no result

func HasWildcards

func HasWildcards(value *string) bool

func Save

func Save(DB db.IDb, table *db.Table, entity IEntity) error

func SoftDelete

func SoftDelete(DB db.IDb, table *db.Table, entity IEntity) error

func SoftDeleteByIdAndVersion

func SoftDeleteByIdAndVersion(DB db.IDb, table *db.Table, id int64, version int64) error

Types

type Criteria

type Criteria struct {
	CountRecords bool    `json:"countRecords"`
	Page         int64   `json:"page"`
	PageSize     int64   `json:"pageSize"`
	OrderBy      *string `json:"orderBy"`
	Ascending    *bool   `json:"ascending"`
}

type EntityBase

type EntityBase struct {
	db.Marker

	Id      *int64 `json:"id"`
	Version *int64 `json:"version"`
}

func (*EntityBase) Copy

func (this *EntityBase) Copy(entity EntityBase)

func (*EntityBase) GetId

func (this *EntityBase) GetId() *int64

func (*EntityBase) GetVersion

func (this *EntityBase) GetVersion() *int64

func (*EntityBase) SetId

func (this *EntityBase) SetId(id *int64)

func (*EntityBase) SetVersion

func (this *EntityBase) SetVersion(version *int64)

type IEntity

type IEntity interface {
	GetId() *int64
	SetId(*int64)
	GetVersion() *int64
	SetVersion(*int64)
}

type IValue

type IValue interface {
	Value() interface{}
}

type Page

type Page struct {
	// max number of records returned by the datasource
	Count *int64 `json:"count"`
	// if this is the last page
	Last    bool          `json:"last"`
	Results []interface{} `json:"results"`
}

func QueryForPage

func QueryForPage(
	query *db.Query,
	criteria Criteria,
	target interface{},
	transformer func(in interface{}) interface{},
) (Page, error)

Jump to

Keyboard shortcuts

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