value

package
v0.0.0-...-ae06870 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NilFloat64 = &Float64{Valid: false}
	NilString  = &String{Valid: false}
	NilBool    = &Bool{Valid: false}
	NilInt64   = &Int64{Valid: false}

	NilSlInt64   = &SlInt64{}
	NilSlFloat64 = &SlFloat64{}
	NilSlString  = &SlString{}
)
View Source
var ErrInvalidValueType = errors.New("invalid value type given")

All defined parsers in order (to avoid false positives)

Functions

func BoolParser

func BoolParser(s string) (interface{}, error)

func Float64Parser

func Float64Parser(s string) (interface{}, error)

func Int64Parser

func Int64Parser(s string) (interface{}, error)

func Parse

func Parse(t Type, s ...string) (v interface{}, err error)

func StringParser

func StringParser(s string) (interface{}, error)

Types

type Bool

type Bool sql.NullBool

func (*Bool) GetValue

func (f *Bool) GetValue() interface{}

func (*Bool) IsNil

func (b *Bool) IsNil() bool

func (*Bool) SetValue

func (f *Bool) SetValue(v interface{}) error

func (*Bool) Strings

func (b *Bool) Strings() (strs []string)

func (*Bool) Type

func (b *Bool) Type() Type

type Float64

type Float64 sql.NullFloat64

func (*Float64) GetValue

func (f *Float64) GetValue() interface{}

func (*Float64) IsNil

func (f *Float64) IsNil() bool

func (*Float64) SetValue

func (f *Float64) SetValue(v interface{}) error

func (*Float64) Strings

func (f *Float64) Strings() (strs []string)

func (*Float64) Type

func (f *Float64) Type() Type

type Int64

type Int64 sql.NullInt64

func (*Int64) GetValue

func (i *Int64) GetValue() interface{}

func (*Int64) IsNil

func (i *Int64) IsNil() bool

func (*Int64) SetValue

func (s *Int64) SetValue(v interface{}) error

func (*Int64) Strings

func (s *Int64) Strings() (strs []string)

func (*Int64) Type

func (i *Int64) Type() Type

type Parser

type Parser func(string) (interface{}, error)

type SlFloat64

type SlFloat64 []*Float64

func (*SlFloat64) GetValue

func (sli *SlFloat64) GetValue() interface{}

func (*SlFloat64) IsNil

func (slf *SlFloat64) IsNil() bool

func (*SlFloat64) SetValue

func (sli *SlFloat64) SetValue(v interface{}) error

func (*SlFloat64) Strings

func (sli *SlFloat64) Strings() (strs []string)

func (*SlFloat64) Type

func (slf *SlFloat64) Type() Type

type SlInt64

type SlInt64 []*Int64

func (*SlInt64) GetValue

func (sli *SlInt64) GetValue() interface{}

func (*SlInt64) IsNil

func (sli *SlInt64) IsNil() bool

func (*SlInt64) SetValue

func (sli *SlInt64) SetValue(v interface{}) error

func (*SlInt64) Strings

func (sli *SlInt64) Strings() (strs []string)

func (*SlInt64) Type

func (sli *SlInt64) Type() Type

type SlString

type SlString []*String

func (*SlString) GetValue

func (sli *SlString) GetValue() interface{}

func (*SlString) IsNil

func (sli *SlString) IsNil() bool

func (*SlString) SetValue

func (sli *SlString) SetValue(v interface{}) error

func (*SlString) Strings

func (sli *SlString) Strings() (strs []string)

func (*SlString) Type

func (sli *SlString) Type() Type

type String

type String sql.NullString

func (*String) GetValue

func (s *String) GetValue() interface{}

func (*String) IsNil

func (s *String) IsNil() bool

func (*String) SetValue

func (s *String) SetValue(v interface{}) error

func (*String) Strings

func (s *String) Strings() (strs []string)

func (*String) Type

func (s *String) Type() Type

type Type

type Type string
const (
	TypeInt64     Type = "int64"
	TypeBool      Type = "bool"
	TypeFloat64   Type = "float64"
	TypeString    Type = "string"
	TypeSlInt64   Type = "slint64"
	TypeSlString  Type = "slstring"
	TypeSlFloat64 Type = "slfloat64"
)

type Value

type Value interface {
	Strings() []string

	GetValue() interface{}
	SetValue(interface{}) error

	Type() Type
	IsNil() bool
}

Jump to

Keyboard shortcuts

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