model

package
v0.0.38 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2024 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrWrongRev = util.ClientSafeError{Message: "This record has been changed by another request since you loaded it. Review the changes by going back and refreshing, and try again if appropriate."}

Functions

func ExecFindByColumn added in v0.0.3

func ExecFindByColumn(ctx context.Context, query string, val any, props []any) error

func ExecSave added in v0.0.3

func ExecSave(ctx context.Context, query string, props []any) error

func FindByColumn

func FindByColumn(table string, colmap *Colmap, col string) (string, []any)

func StandardSave

func StandardSave(table string, colmap *Colmap, auditQuery string) (string, []any, string)

Types

type Audit

type Audit struct {
	ID             string
	EntityID       string
	OrganisationID string
	TableName      string
	Stamp          time.Time
	UserID         string
	UserName       string
	Action         string
	OldRowData     string

	NewRowData string

	Diff string
	// contains filtered or unexported fields
}

type Audits

type Audits struct {
	Data     []Audit
	Criteria Criteria
}

func (*Audits) FindAll

func (this *Audits) FindAll(ctx context.Context, criteria Criteria) error

type Colmap added in v0.0.3

type Colmap map[string]any

func (*Colmap) ByKeys added in v0.0.3

func (this *Colmap) ByKeys(keys []string) (props []any)

func (*Colmap) Delete added in v0.0.3

func (this *Colmap) Delete(keys ...string) *Colmap

func (*Colmap) Split added in v0.0.3

func (this *Colmap) Split() (cols []string, props []any)

func (*Colmap) Strip added in v0.0.3

func (this *Colmap) Strip(table string) *Colmap

type Criteria

type Criteria struct {
	Query      query.Query
	Filters    filter.Filters
	Pagination pagination.Pagination
}

type ErrInvalidQuery added in v0.0.6

type ErrInvalidQuery struct {
	Query interface{}
	Model string
}

func (ErrInvalidQuery) Error added in v0.0.6

func (this ErrInvalidQuery) Error() string

type Markedup added in v0.0.14

type Markedup string

func (*Markedup) FromString added in v0.0.14

func (this *Markedup) FromString(input string)

func (Markedup) String added in v0.0.14

func (this Markedup) String() string

type Model

type Model interface {
	Save(context.Context) error
	FindByID(context.Context, string) error
	FindByColumn(context.Context, string, string) error
	NullDynamicValues()
	Blank() Model
	Id() string
	Tablename() string
	Query(Criteria) string
}

type Querier

type Querier interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
	QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
	QueryRowContext(ctx context.Context, query string, args ...interface{}) *sql.Row
}

Jump to

Keyboard shortcuts

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