Documentation ¶
Overview ¶
Package literal provides an abstraction to manipulate BadWolf literals.
Index ¶
- type Builder
- type Literal
- func (l *Literal) Blob() ([]byte, error)
- func (l *Literal) Bool() (bool, error)
- func (l *Literal) Float64() (float64, error)
- func (l *Literal) Int64() (int64, error)
- func (l *Literal) Interface() interface{}
- func (l *Literal) String() string
- func (l *Literal) Text() (string, error)
- func (l *Literal) ToComparableString() string
- func (l *Literal) Type() Type
- func (l *Literal) UUID() uuid.UUID
- type Type
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Builder ¶
type Builder interface { Build(t Type, v interface{}) (*Literal, error) Parse(s string) (*Literal, error) }
Builder interface provides a standard way to build literals given a type and a given value.
func DefaultBuilder ¶
func DefaultBuilder() Builder
DefaultBuilder returns a builder with no constraints or checks.
func NewBoundedBuilder ¶
NewBoundedBuilder creates a builder that guarantees that no literal will be created if the size of the string or a blob is bigger than the provided maximum.
type Literal ¶
type Literal struct {
// contains filtered or unexported fields
}
Literal represents the type and value boxed in the literal.
func (*Literal) Interface ¶
func (l *Literal) Interface() interface{}
Interface returns the value as a simple interface{}.
func (*Literal) ToComparableString ¶
ToComparableString returns a string that can be directly compared.
type Type ¶
type Type uint8
Type represents the type contained in a literal.
const ( // Bool indicates that the type contained in the literal is a bool. Bool Type = iota // Int64 indicates that the type contained in the literal is an int64. Int64 // Float64 indicates that the type contained in the literal is a float64. Float64 // Text indicates that the type contained in the literal is a string. Text // Blob indicates that the type contained in the literal is a []byte. Blob )
Click to show internal directories.
Click to hide internal directories.