types

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2021 License: Apache-2.0 Imports: 10 Imported by: 7

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

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

A Context is a map of objects that is passed along from function to function during a transaction. A Context is read only.

func NewContext

func NewContext() *Context

NewContext returns a new Context instance

func (Context) Copy

func (c Context) Copy() *Context

Copy returns a shallow copy of the Context

func (*Context) Delete

func (c *Context) Delete(key string) *Context

Delete removes the content pointed by the given key from the context.

func (*Context) Get

func (c *Context) Get(key string) interface{}

Get returns the value of the given key in this Context It returns nil if the key is not in this context

func (*Context) GetBool

func (c *Context) GetBool(key string) bool

GetBool returns the value of the given key in this Context as a bool. It returns false if there is no such key in the context. It panics if the value cannot be casted to bool

func (*Context) GetDate

func (c *Context) GetDate(key string) dates.Date

GetDate returns the value of the given key in this Context as a Date. It returns an null Date if there is no such key in the context. It panics if the value is not of type Date

func (*Context) GetDateTime

func (c *Context) GetDateTime(key string) dates.DateTime

GetDateTime returns the value of the given key in this Context as a DateTime. It returns an null DateTime if there is no such key in the context. It panics if the value is not of type DateTime

func (*Context) GetFloat

func (c *Context) GetFloat(key string) float64

GetFloat returns the value of the given key in this Context as a float64. It returns 0 if there is no such key in the context. It panics if the value cannot be casted to float64

func (*Context) GetFloatSlice

func (c *Context) GetFloatSlice(key string) []float64

GetFloatSlice returns the value of the given key in this Context as a []float64. It returns an empty slice if there is no such key in the context. It panics if the value is not a slice or if any value cannot be casted to float64

func (*Context) GetInteger

func (c *Context) GetInteger(key string) int64

GetInteger returns the value of the given key in this Context as an int64. It returns 0 if there is no such key in the context. It panics if the value cannot be casted to int64

func (*Context) GetIntegerSlice

func (c *Context) GetIntegerSlice(key string) []int64

GetIntegerSlice returns the value of the given key in this Context as a []int64. It returns an empty slice if there is no such key in the context. It panics if the value is not a slice or if any value cannot be casted to int64

func (*Context) GetString

func (c *Context) GetString(key string) string

GetString returns the value of the given key in this Context as a string. It returns an empty string if there is no such key in the context. It panics if the value is not of type string

func (*Context) GetStringSlice

func (c *Context) GetStringSlice(key string) []string

GetStringSlice returns the value of the given key in this Context as a []string. It returns an empty slice if there is no such key in the context. It panics if the value is not a slice or if any value is not a string

func (*Context) HasKey

func (c *Context) HasKey(key string) bool

HasKey returns true if this Context has the given key

func (Context) IsEmpty

func (c Context) IsEmpty() bool

IsEmpty returns true if this Context has no entries.

func (*Context) MarshalJSON

func (c *Context) MarshalJSON() ([]byte, error)

MarshalJSON method for Context

func (*Context) Pop

func (c *Context) Pop(key string) interface{}

Pop removes the content pointed by the given key from the context. and returns the value

func (*Context) Scan

func (c *Context) Scan(src interface{}) error

Scan JSON decodes the value of the database into a Context

func (Context) String

func (c Context) String() string

String function for Context type

func (Context) ToMap

func (c Context) ToMap() map[string]interface{}

ToMap returns a copy of the map of values of this context

func (*Context) UnmarshalJSON

func (c *Context) UnmarshalJSON(data []byte) error

UnmarshalJSON method for Context

func (*Context) UnmarshalXMLAttr

func (c *Context) UnmarshalXMLAttr(attr xml.Attr) error

UnmarshalXMLAttr is the XML unmarshalling method of Context.

func (*Context) Update added in v0.1.9

func (c *Context) Update(other *Context)

Update this context with the other

func (Context) Value

func (c Context) Value() (driver.Value, error)

Value JSON encode our Context for storing in the database.

func (Context) WithKey

func (c Context) WithKey(key string, value interface{}) *Context

WithKey returns a copy of this context with the given key/value. If key already exists, it is overwritten.

type RecordSet

type RecordSet interface {
	// ModelName returns the name of the model of this RecordSet
	ModelName() string
	// Ids returns the ids in this set of Records
	Ids() []int64
	// Len returns the number of records in this RecordSet
	Len() int
	// IsEmpty returns true if this RecordSet has no records
	IsEmpty() bool
	// IsNotEmpty returns true if this RecordSet has at least one record
	IsNotEmpty() bool
	// Call executes the given method (as string) with the given arguments
	Call(string, ...interface{}) interface{}
}

RecordSet identifies a type that holds a set of records of a given model. Dummy interface in types module.

type Selection

type Selection map[string]string

A Selection is a set of possible (key, label) values for a model "selection" field.

func (Selection) MarshalJSON

func (s Selection) MarshalJSON() ([]byte, error)

MarshalJSON function for the Selection type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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