pg

package
v0.12.17 Latest Latest
Warning

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

Go to latest
Published: May 28, 2020 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetGroups

func GetGroups(user string) (lis []string, err error)

GetGroups get list of groups

func GetNotify

func GetNotify(event string) (lis mercury.ListNotify)

GetNotify get list of rules

func GetRules

func GetRules(user ident.Ident) (lis mercury.Rules, err error)

GetRules get list of rules

func WriteConfig

func WriteConfig(tx *dbm.Tx, config mercury.Config) (err error)

WriteConfig writes a config map to database

func WriteSpaces

func WriteSpaces(tx *dbm.Tx, delete squirrel.Sqlizer, lis []Space) (err error)

WriteSpaces writes the spaces to db

func WriteValues

func WriteValues(tx *dbm.Tx, delete squirrel.Sqlizer, lis []Value) (err error)

WriteValues writes the values to db

Types

type Config

type Config struct {
	ID     uint64   `json:"id" view:"mercury_registry_vw"`
	Seq    uint64   `json:"seq"`
	Space  string   `json:"space"`
	Name   string   `json:"name"`
	Values []string `json:"values" cont:"ListStrings"`
	Notes  []string `json:"notes" cont:"ListStrings"`
	Tags   []string `json:"tags" cont:"ListStrings"`
}

Config stores the attributes for a registry space

func ListConfig

func ListConfig(where interface{}, limit, offset uint64, order []string) (lis []Config, err error)

ListConfig queries a list of Config

func ListConfigContext

func ListConfigContext(ctx context.Context, where interface{}, limit, offset uint64, order []string) (lis []Config, err error)

ListConfigContext queries a list of User with Context

func ListConfigQry

func ListConfigQry(ctx context.Context, q qry.Input) (lis []Config, err error)

ListConfigQry queries a list of Config with Context

type ConfigTx

type ConfigTx struct {
	*Config
	Where squirrel.Eq
	Tx    *dbm.Tx
}

ConfigTx adds transaction to model

type Mode

type Mode int

Mode of insert or update

const (
	// Insert row to table
	Insert Mode = iota
	// Update row in table
	Update
)

type NotFoundError

type NotFoundError string

NotFoundError matching row not found

func (NotFoundError) Error

func (n NotFoundError) Error() string

Error format message as string

type Notify

type Notify struct {
	Name   string `json:"name" view:"mercury_notify_vw"`
	Match  string `json:"match"`
	Event  string `json:"event"`
	Method string `json:"-" db:"method"`
	URL    string `json:"-" db:"url"`
}

Notify stores the attributes for a registry space

type ParseError

type ParseError string

ParseError failed to parse query

func (ParseError) Error

func (n ParseError) Error() string

Error format message as string

type Space

type Space struct {
	ID    uint64   `json:"id" db:",AUTO" table:"mercury_spaces"`
	Space string   `json:"space"`
	Tags  []string `json:"tags" cont:"ListStrings"`
	Notes []string `json:"notes" cont:"ListStrings"`
	Items []Value  `json:"items" db:"-"`
}

Space stores a space value

func ListSpace

func ListSpace(where interface{}, limit, offset uint64, order []string) (lis []Space, err error)

ListSpace queries a list of Space

func ListSpaceContext

func ListSpaceContext(ctx context.Context, where interface{}, limit, offset uint64, order []string) (lis []Space, err error)

ListSpaceContext queries a list of User with Context

func ListSpaceQry

func ListSpaceQry(ctx context.Context, q qry.Input) (lis []Space, err error)

ListSpaceQry queries a list of Space with Context

func PutSpace

func PutSpace(id uint64, fn func(Mode, dbm.DbInfo, SpaceTx) error) (o Space, err error)

PutSpace prepares a transaction to save Space

type SpaceTx

type SpaceTx struct {
	*Space
	Where squirrel.Eq
	Tx    *dbm.Tx
}

SpaceTx adds transaction to model

func (SpaceTx) Save

func (o SpaceTx) Save() (err error)

Save stores Space to DB

type Value

type Value struct {
	ID     uint64   `json:"id" db:",AUTO" table:"mercury_values"`
	Seq    uint64   `json:"seq"`
	Name   string   `json:"name"`
	Values []string `json:"values" cont:"ListStrings"`
	Notes  []string `json:"notes"  cont:"ListStrings"`
	Tags   []string `json:"tags"   cont:"ListStrings"`
}

Value stores the attributes for a registry space

Jump to

Keyboard shortcuts

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