value

package
v0.0.0-...-4d2ef29 Latest Latest
Warning

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

Go to latest
Published: Aug 13, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TimeOutputFormat is used to output all time.
	TimeOutputFormat = "2006-01-02 15:04:05"
)

time.Time formats.

Variables

View Source
var (
	ConstTrue  Bool  = true
	ConstFalse Bool  = false
	ConstNull  Null  = Null{}
	ConstTable Table = Table{}
)

Functions

func Compare

func Compare(a, b Value) int

func CompareBool

func CompareBool(d, v bool) int

CompareBool compare the input bools according to the SQL comparison rules.

func MustBeBool

func MustBeBool(v interface{}) bool

MustBeBool attempts to retrieve a Bool from a value, panicking if the assertion fails.

func MustBeFloat

func MustBeFloat(v interface{}) float64

func MustBeInt

func MustBeInt(v interface{}) int64

MustBeInt attempts to retrieve a Int from a value, panicking if the assertion fails.

func MustBeString

func MustBeString(v interface{}) string

func MustBeTable

func MustBeTable(v interface{}) string

func MustBeTime

func MustBeTime(v interface{}) time.Time

Types

type Array

type Array []Value

func (Array) Attributes

func (_ Array) Attributes() []string

func (Array) Compare

func (a Array) Compare(v Value) int

func (Array) Eval

func (a Array) Eval(_ map[string]Value) (Value, error)

func (Array) IsLogical

func (_ Array) IsLogical() bool

func (Array) Len

func (a Array) Len() int

func (Array) Less

func (a Array) Less(i, j int) bool

func (Array) ResolvedType

func (_ Array) ResolvedType() *types.T

func (Array) Size

func (a Array) Size() int

func (Array) String

func (a Array) String() string

func (Array) Swap

func (a Array) Swap(i, j int)

type Bool

type Bool bool

func AsBool

func AsBool(v interface{}) (Bool, bool)

func GetBool

func GetBool(v Value) (Bool, error)

GetBool get Bool or an error.

func NewBool

func NewBool(v bool) *Bool

func ParseBool

func ParseBool(s string) (*Bool, error)

func (*Bool) Attributes

func (_ *Bool) Attributes() []string

func (*Bool) Compare

func (a *Bool) Compare(v Value) int

func (*Bool) Eval

func (a *Bool) Eval(_ map[string]Value) (Value, error)

func (*Bool) IsLogical

func (_ *Bool) IsLogical() bool

func (*Bool) ResolvedType

func (_ *Bool) ResolvedType() *types.T

func (*Bool) Size

func (_ *Bool) Size() int

func (*Bool) String

func (a *Bool) String() string

type Float

type Float float64

func AsFloat

func AsFloat(v interface{}) (Float, bool)

func GetFloat

func GetFloat(v Value) (Float, error)

func NewFloat

func NewFloat(v float64) *Float

func ParseFloat

func ParseFloat(s string) (*Float, error)

ParseFloat parses and returns the *Float value represented by the provided string, or an error if parsing is unsuccessful.

func (*Float) Attributes

func (_ *Float) Attributes() []string

func (*Float) Compare

func (a *Float) Compare(v Value) int

func (*Float) Eval

func (a *Float) Eval(_ map[string]Value) (Value, error)

func (*Float) IsLogical

func (_ *Float) IsLogical() bool

func (*Float) ResolvedType

func (_ *Float) ResolvedType() *types.T

func (*Float) Size

func (_ *Float) Size() int

func (*Float) String

func (a *Float) String() string

type Int

type Int int64

func AsInt

func AsInt(v interface{}) (Int, bool)

func GetInt

func GetInt(v Value) (Int, error)

func NewInt

func NewInt(v int64) *Int

func ParseInt

func ParseInt(s string) (*Int, error)

ParseInt parses and returns the *Int value represented by the provided string, or an error if parsing is unsuccessful.

func (*Int) Attributes

func (_ *Int) Attributes() []string

func (*Int) Compare

func (a *Int) Compare(v Value) int

func (*Int) Eval

func (a *Int) Eval(_ map[string]Value) (Value, error)

func (*Int) IsLogical

func (_ *Int) IsLogical() bool

func (*Int) ResolvedType

func (_ *Int) ResolvedType() *types.T

func (*Int) Size

func (_ *Int) Size() int

func (*Int) String

func (a *Int) String() string

type Null

type Null struct{}

func (Null) Attributes

func (_ Null) Attributes() []string

func (Null) Compare

func (a Null) Compare(v Value) int

func (Null) Eval

func (a Null) Eval(_ map[string]Value) (Value, error)

func (Null) IsLogical

func (_ Null) IsLogical() bool

func (Null) ResolvedType

func (_ Null) ResolvedType() *types.T

func (Null) Size

func (_ Null) Size() int

func (Null) String

func (_ Null) String() string

type String

type String string

func AsString

func AsString(v interface{}) (String, bool)

func GetString

func GetString(v Value) (String, error)

func NewString

func NewString(v string) *String

func (*String) Attributes

func (_ *String) Attributes() []string

func (*String) Compare

func (a *String) Compare(v Value) int

func (*String) Eval

func (a *String) Eval(_ map[string]Value) (Value, error)

func (*String) IsLogical

func (_ *String) IsLogical() bool

func (*String) ResolvedType

func (_ *String) ResolvedType() *types.T

func (*String) Size

func (a *String) Size() int

func (*String) String

func (a *String) String() string

type Table

type Table struct {
	Id string
}

func AsTable

func AsTable(v interface{}) (Table, bool)

func GetTable

func GetTable(v Value) (Table, error)

func NewTable

func NewTable(id string) *Table

func (*Table) Attributes

func (_ *Table) Attributes() []string

func (*Table) Compare

func (a *Table) Compare(v Value) int

func (*Table) Eval

func (a *Table) Eval(_ map[string]Value) (Value, error)

func (*Table) IsLogical

func (_ *Table) IsLogical() bool

func (*Table) ResolvedType

func (_ *Table) ResolvedType() *types.T

func (*Table) Size

func (a *Table) Size() int

func (*Table) String

func (a *Table) String() string

type Time

type Time struct {
	time.Time
}

func AsTime

func AsTime(v interface{}) (Time, bool)

func GetTime

func GetTime(v Value) (Time, error)

func NewTime

func NewTime(t time.Time) *Time

func ParseTime

func ParseTime(s string) (*Time, error)

ParseTime parses and returns the *Time value represented by the provided string in UTC, or an error if parsing is unsuccessful.

func (*Time) Attributes

func (_ *Time) Attributes() []string

func (*Time) Compare

func (a *Time) Compare(v Value) int

func (*Time) Eval

func (a *Time) Eval(_ map[string]Value) (Value, error)

func (*Time) IsLogical

func (_ *Time) IsLogical() bool

func (*Time) ResolvedType

func (_ *Time) ResolvedType() *types.T

func (*Time) Size

func (_ *Time) Size() int

func (*Time) String

func (a *Time) String() string

type Value

type Value interface {
	Size() int

	String() string
	Compare(Value) int
	ResolvedType() *types.T

	IsLogical() bool
	Attributes() []string
	Eval(map[string]Value) (Value, error)
}

Jump to

Keyboard shortcuts

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