mixins

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2022 License: MIT Imports: 3 Imported by: 25

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SplitExact added in v0.4.0

func SplitExact(s string, sep string, count int) ([]string, error)

SplitExact is much like strings.Split but will error if the number of substrings is other than the expected count.

SplitExact is used by the 'stringjoin' representation for structs.

The 'count' parameter is a length. In other words, if you expect the zero'th index to be present in the result, you should ask for a count of at least '1'. Using this function with 'count' less than 2 is rather strange.

func SplitN added in v0.9.0

func SplitN(s, sep string, n int) []string

SplitN is an alias of strings.SplitN, which is only present here to make it usable in codegen packages without requiring conditional imports in the generation process.

Types

type Bool

type Bool struct {
	TypeName string
}

Bool can be embedded in a struct to provide all the methods that have fixed output for any int-kinded nodes. (Mostly this includes all the methods which simply return ErrWrongKind.) Other methods will still need to be implemented to finish conforming to Node.

To conserve memory and get a TypeName in errors without embedding, write methods on your type with a body that simply initializes this struct and immediately uses the relevant method; this is more verbose in source, but compiles to a tighter result: in memory, there's no embed; and in runtime, the calls will be inlined and thus have no cost in execution time.

func (Bool) AsBytes

func (x Bool) AsBytes() ([]byte, error)

func (Bool) AsFloat

func (x Bool) AsFloat() (float64, error)

func (Bool) AsInt

func (x Bool) AsInt() (int64, error)
func (x Bool) AsLink() (datamodel.Link, error)

func (Bool) AsString

func (x Bool) AsString() (string, error)

func (Bool) IsAbsent added in v0.5.0

func (Bool) IsAbsent() bool

func (Bool) IsNull

func (Bool) IsNull() bool

func (Bool) Kind added in v0.7.0

func (Bool) Kind() datamodel.Kind

func (Bool) Length

func (Bool) Length() int64

func (Bool) ListIterator

func (Bool) ListIterator() datamodel.ListIterator

func (Bool) LookupByIndex added in v0.5.0

func (x Bool) LookupByIndex(idx int64) (datamodel.Node, error)

func (Bool) LookupByNode added in v0.5.0

func (x Bool) LookupByNode(key datamodel.Node) (datamodel.Node, error)

func (Bool) LookupBySegment added in v0.5.0

func (x Bool) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error)

func (Bool) LookupByString added in v0.5.0

func (x Bool) LookupByString(string) (datamodel.Node, error)

func (Bool) MapIterator

func (Bool) MapIterator() datamodel.MapIterator

type BoolAssembler

type BoolAssembler struct {
	TypeName string
}

BoolAssembler has similar purpose as Bool, but for (you guessed it) the NodeAssembler interface rather than the Node interface.

func (BoolAssembler) AssignBytes

func (x BoolAssembler) AssignBytes([]byte) error

func (BoolAssembler) AssignFloat

func (x BoolAssembler) AssignFloat(float64) error

func (BoolAssembler) AssignInt

func (x BoolAssembler) AssignInt(int64) error
func (x BoolAssembler) AssignLink(datamodel.Link) error

func (BoolAssembler) AssignNull

func (x BoolAssembler) AssignNull() error

func (BoolAssembler) AssignString

func (x BoolAssembler) AssignString(string) error

func (BoolAssembler) BeginList

func (x BoolAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error)

func (BoolAssembler) BeginMap

func (x BoolAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error)

type Bytes

type Bytes struct {
	TypeName string
}

Bytes can be embedded in a struct to provide all the methods that have fixed output for any int-kinded nodes. (Mostly this includes all the methods which simply return ErrWrongKind.) Other methods will still need to be implemented to finish conforming to Node.

To conserve memory and get a TypeName in errors without embedding, write methods on your type with a body that simply initializes this struct and immediately uses the relevant method; this is more verbose in source, but compiles to a tighter result: in memory, there's no embed; and in runtime, the calls will be inlined and thus have no cost in execution time.

func (Bytes) AsBool

func (x Bytes) AsBool() (bool, error)

func (Bytes) AsFloat

func (x Bytes) AsFloat() (float64, error)

func (Bytes) AsInt

func (x Bytes) AsInt() (int64, error)
func (x Bytes) AsLink() (datamodel.Link, error)

func (Bytes) AsString

func (x Bytes) AsString() (string, error)

func (Bytes) IsAbsent added in v0.5.0

func (Bytes) IsAbsent() bool

func (Bytes) IsNull

func (Bytes) IsNull() bool

func (Bytes) Kind added in v0.7.0

func (Bytes) Kind() datamodel.Kind

func (Bytes) Length

func (Bytes) Length() int64

func (Bytes) ListIterator

func (Bytes) ListIterator() datamodel.ListIterator

func (Bytes) LookupByIndex added in v0.5.0

func (x Bytes) LookupByIndex(idx int64) (datamodel.Node, error)

func (Bytes) LookupByNode added in v0.5.0

func (x Bytes) LookupByNode(key datamodel.Node) (datamodel.Node, error)

func (Bytes) LookupBySegment added in v0.5.0

func (x Bytes) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error)

func (Bytes) LookupByString added in v0.5.0

func (x Bytes) LookupByString(string) (datamodel.Node, error)

func (Bytes) MapIterator

func (Bytes) MapIterator() datamodel.MapIterator

type BytesAssembler

type BytesAssembler struct {
	TypeName string
}

BytesAssembler has similar purpose as Bytes, but for (you guessed it) the NodeAssembler interface rather than the Node interface.

func (BytesAssembler) AssignBool

func (x BytesAssembler) AssignBool(bool) error

func (BytesAssembler) AssignFloat

func (x BytesAssembler) AssignFloat(float64) error

func (BytesAssembler) AssignInt

func (x BytesAssembler) AssignInt(int64) error
func (x BytesAssembler) AssignLink(datamodel.Link) error

func (BytesAssembler) AssignNull

func (x BytesAssembler) AssignNull() error

func (BytesAssembler) AssignString

func (x BytesAssembler) AssignString(string) error

func (BytesAssembler) BeginList

func (x BytesAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error)

func (BytesAssembler) BeginMap

func (x BytesAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error)

type Float

type Float struct {
	TypeName string
}

Float can be embedded in a struct to provide all the methods that have fixed output for any int-kinded nodes. (Mostly this includes all the methods which simply return ErrWrongKind.) Other methods will still need to be implemented to finish conforming to Node.

To conserve memory and get a TypeName in errors without embedding, write methods on your type with a body that simply initializes this struct and immediately uses the relevant method; this is more verbose in source, but compiles to a tighter result: in memory, there's no embed; and in runtime, the calls will be inlined and thus have no cost in execution time.

func (Float) AsBool

func (x Float) AsBool() (bool, error)

func (Float) AsBytes

func (x Float) AsBytes() ([]byte, error)

func (Float) AsInt

func (x Float) AsInt() (int64, error)
func (x Float) AsLink() (datamodel.Link, error)

func (Float) AsString

func (x Float) AsString() (string, error)

func (Float) IsAbsent added in v0.5.0

func (Float) IsAbsent() bool

func (Float) IsNull

func (Float) IsNull() bool

func (Float) Kind added in v0.7.0

func (Float) Kind() datamodel.Kind

func (Float) Length

func (Float) Length() int64

func (Float) ListIterator

func (Float) ListIterator() datamodel.ListIterator

func (Float) LookupByIndex added in v0.5.0

func (x Float) LookupByIndex(idx int64) (datamodel.Node, error)

func (Float) LookupByNode added in v0.5.0

func (x Float) LookupByNode(key datamodel.Node) (datamodel.Node, error)

func (Float) LookupBySegment added in v0.5.0

func (x Float) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error)

func (Float) LookupByString added in v0.5.0

func (x Float) LookupByString(string) (datamodel.Node, error)

func (Float) MapIterator

func (Float) MapIterator() datamodel.MapIterator

type FloatAssembler

type FloatAssembler struct {
	TypeName string
}

FloatAssembler has similar purpose as Float, but for (you guessed it) the NodeAssembler interface rather than the Node interface.

func (FloatAssembler) AssignBool

func (x FloatAssembler) AssignBool(bool) error

func (FloatAssembler) AssignBytes

func (x FloatAssembler) AssignBytes([]byte) error

func (FloatAssembler) AssignInt

func (x FloatAssembler) AssignInt(int64) error
func (x FloatAssembler) AssignLink(datamodel.Link) error

func (FloatAssembler) AssignNull

func (x FloatAssembler) AssignNull() error

func (FloatAssembler) AssignString

func (x FloatAssembler) AssignString(string) error

func (FloatAssembler) BeginList

func (x FloatAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error)

func (FloatAssembler) BeginMap

func (x FloatAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error)

type Int

type Int struct {
	TypeName string
}

Int can be embedded in a struct to provide all the methods that have fixed output for any int-kinded nodes. (Mostly this includes all the methods which simply return ErrWrongKind.) Other methods will still need to be implemented to finish conforming to Node.

To conserve memory and get a TypeName in errors without embedding, write methods on your type with a body that simply initializes this struct and immediately uses the relevant method; this is more verbose in source, but compiles to a tighter result: in memory, there's no embed; and in runtime, the calls will be inlined and thus have no cost in execution time.

func (Int) AsBool

func (x Int) AsBool() (bool, error)

func (Int) AsBytes

func (x Int) AsBytes() ([]byte, error)

func (Int) AsFloat

func (x Int) AsFloat() (float64, error)
func (x Int) AsLink() (datamodel.Link, error)

func (Int) AsString

func (x Int) AsString() (string, error)

func (Int) IsAbsent added in v0.5.0

func (Int) IsAbsent() bool

func (Int) IsNull

func (Int) IsNull() bool

func (Int) Kind added in v0.7.0

func (Int) Kind() datamodel.Kind

func (Int) Length

func (Int) Length() int64

func (Int) ListIterator

func (Int) ListIterator() datamodel.ListIterator

func (Int) LookupByIndex added in v0.5.0

func (x Int) LookupByIndex(idx int64) (datamodel.Node, error)

func (Int) LookupByNode added in v0.5.0

func (x Int) LookupByNode(key datamodel.Node) (datamodel.Node, error)

func (Int) LookupBySegment added in v0.5.0

func (x Int) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error)

func (Int) LookupByString added in v0.5.0

func (x Int) LookupByString(string) (datamodel.Node, error)

func (Int) MapIterator

func (Int) MapIterator() datamodel.MapIterator

type IntAssembler

type IntAssembler struct {
	TypeName string
}

IntAssembler has similar purpose as Int, but for (you guessed it) the NodeAssembler interface rather than the Node interface.

func (IntAssembler) AssignBool

func (x IntAssembler) AssignBool(bool) error

func (IntAssembler) AssignBytes

func (x IntAssembler) AssignBytes([]byte) error

func (IntAssembler) AssignFloat

func (x IntAssembler) AssignFloat(float64) error
func (x IntAssembler) AssignLink(datamodel.Link) error

func (IntAssembler) AssignNull

func (x IntAssembler) AssignNull() error

func (IntAssembler) AssignString

func (x IntAssembler) AssignString(string) error

func (IntAssembler) BeginList

func (x IntAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error)

func (IntAssembler) BeginMap

func (x IntAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error)
type Link struct {
	TypeName string
}

Link can be embedded in a struct to provide all the methods that have fixed output for any int-kinded nodes. (Mostly this includes all the methods which simply return ErrWrongKind.) Other methods will still need to be implemented to finish conforming to Node.

To conserve memory and get a TypeName in errors without embedding, write methods on your type with a body that simply initializes this struct and immediately uses the relevant method; this is more verbose in source, but compiles to a tighter result: in memory, there's no embed; and in runtime, the calls will be inlined and thus have no cost in execution time.

func (Link) AsBool

func (x Link) AsBool() (bool, error)

func (Link) AsBytes

func (x Link) AsBytes() ([]byte, error)

func (Link) AsFloat

func (x Link) AsFloat() (float64, error)

func (Link) AsInt

func (x Link) AsInt() (int64, error)

func (Link) AsString

func (x Link) AsString() (string, error)

func (Link) IsAbsent added in v0.5.0

func (Link) IsAbsent() bool

func (Link) IsNull

func (Link) IsNull() bool

func (Link) Kind added in v0.7.0

func (Link) Kind() datamodel.Kind

func (Link) Length

func (Link) Length() int64

func (Link) ListIterator

func (Link) ListIterator() datamodel.ListIterator

func (Link) LookupByIndex added in v0.5.0

func (x Link) LookupByIndex(idx int64) (datamodel.Node, error)

func (Link) LookupByNode added in v0.5.0

func (x Link) LookupByNode(key datamodel.Node) (datamodel.Node, error)

func (Link) LookupBySegment added in v0.5.0

func (x Link) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error)

func (Link) LookupByString added in v0.5.0

func (x Link) LookupByString(string) (datamodel.Node, error)

func (Link) MapIterator

func (Link) MapIterator() datamodel.MapIterator

type LinkAssembler

type LinkAssembler struct {
	TypeName string
}

LinkAssembler has similar purpose as Link, but for (you guessed it) the NodeAssembler interface rather than the Node interface.

func (LinkAssembler) AssignBool

func (x LinkAssembler) AssignBool(bool) error

func (LinkAssembler) AssignBytes

func (x LinkAssembler) AssignBytes([]byte) error

func (LinkAssembler) AssignFloat

func (x LinkAssembler) AssignFloat(float64) error

func (LinkAssembler) AssignInt

func (x LinkAssembler) AssignInt(int64) error

func (LinkAssembler) AssignNull

func (x LinkAssembler) AssignNull() error

func (LinkAssembler) AssignString

func (x LinkAssembler) AssignString(string) error

func (LinkAssembler) BeginList

func (x LinkAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error)

func (LinkAssembler) BeginMap

func (x LinkAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error)

type List

type List struct {
	TypeName string
}

List can be embedded in a struct to provide all the methods that have fixed output for any int-kinded nodes. (Mostly this includes all the methods which simply return ErrWrongKind.) Other methods will still need to be implemented to finish conforming to Node.

To conserve memory and get a TypeName in errors without embedding, write methods on your type with a body that simply initializes this struct and immediately uses the relevant method; this is more verbose in source, but compiles to a tighter result: in memory, there's no embed; and in runtime, the calls will be inlined and thus have no cost in execution time.

func (List) AsBool

func (x List) AsBool() (bool, error)

func (List) AsBytes

func (x List) AsBytes() ([]byte, error)

func (List) AsFloat

func (x List) AsFloat() (float64, error)

func (List) AsInt

func (x List) AsInt() (int64, error)
func (x List) AsLink() (datamodel.Link, error)

func (List) AsString

func (x List) AsString() (string, error)

func (List) IsAbsent added in v0.5.0

func (List) IsAbsent() bool

func (List) IsNull

func (List) IsNull() bool

func (List) Kind added in v0.7.0

func (List) Kind() datamodel.Kind

func (List) LookupByNode added in v0.5.0

func (x List) LookupByNode(key datamodel.Node) (datamodel.Node, error)

func (List) LookupByString added in v0.5.0

func (x List) LookupByString(string) (datamodel.Node, error)

func (List) MapIterator

func (List) MapIterator() datamodel.MapIterator

type ListAssembler

type ListAssembler struct {
	TypeName string
}

ListAssembler has similar purpose as List, but for (you guessed it) the NodeAssembler interface rather than the Node interface.

func (ListAssembler) AssignBool

func (x ListAssembler) AssignBool(bool) error

func (ListAssembler) AssignBytes

func (x ListAssembler) AssignBytes([]byte) error

func (ListAssembler) AssignFloat

func (x ListAssembler) AssignFloat(float64) error

func (ListAssembler) AssignInt

func (x ListAssembler) AssignInt(int64) error
func (x ListAssembler) AssignLink(datamodel.Link) error

func (ListAssembler) AssignNull

func (x ListAssembler) AssignNull() error

func (ListAssembler) AssignString

func (x ListAssembler) AssignString(string) error

func (ListAssembler) BeginMap

func (x ListAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error)

type Map

type Map struct {
	TypeName string
}

Map can be embedded in a struct to provide all the methods that have fixed output for any map-kinded nodes. (Mostly this includes all the methods which simply return ErrWrongKind.) Other methods will still need to be implemented to finish conforming to Node.

To conserve memory and get a TypeName in errors without embedding, write methods on your type with a body that simply initializes this struct and immediately uses the relevant method; this is more verbose in source, but compiles to a tighter result: in memory, there's no embed; and in runtime, the calls will be inlined and thus have no cost in execution time.

func (Map) AsBool

func (x Map) AsBool() (bool, error)

func (Map) AsBytes

func (x Map) AsBytes() ([]byte, error)

func (Map) AsFloat

func (x Map) AsFloat() (float64, error)

func (Map) AsInt

func (x Map) AsInt() (int64, error)
func (x Map) AsLink() (datamodel.Link, error)

func (Map) AsString

func (x Map) AsString() (string, error)

func (Map) IsAbsent added in v0.5.0

func (Map) IsAbsent() bool

func (Map) IsNull

func (Map) IsNull() bool

func (Map) Kind added in v0.7.0

func (Map) Kind() datamodel.Kind

func (Map) ListIterator

func (Map) ListIterator() datamodel.ListIterator

func (Map) LookupByIndex added in v0.5.0

func (x Map) LookupByIndex(idx int64) (datamodel.Node, error)

type MapAssembler

type MapAssembler struct {
	TypeName string
}

MapAssembler has similar purpose as Map, but for (you guessed it) the NodeAssembler interface rather than the Node interface.

func (MapAssembler) AssignBool

func (x MapAssembler) AssignBool(bool) error

func (MapAssembler) AssignBytes

func (x MapAssembler) AssignBytes([]byte) error

func (MapAssembler) AssignFloat

func (x MapAssembler) AssignFloat(float64) error

func (MapAssembler) AssignInt

func (x MapAssembler) AssignInt(int64) error
func (x MapAssembler) AssignLink(datamodel.Link) error

func (MapAssembler) AssignNull

func (x MapAssembler) AssignNull() error

func (MapAssembler) AssignString

func (x MapAssembler) AssignString(string) error

func (MapAssembler) BeginList

func (x MapAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error)

type String

type String struct {
	TypeName string
}

String can be embedded in a struct to provide all the methods that have fixed output for any string-kinded nodes. (Mostly this includes all the methods which simply return ErrWrongKind.) Other methods will still need to be implemented to finish conforming to Node.

To conserve memory and get a TypeName in errors without embedding, write methods on your type with a body that simply initializes this struct and immediately uses the relevant method; this is more verbose in source, but compiles to a tighter result: in memory, there's no embed; and in runtime, the calls will be inlined and thus have no cost in execution time.

func (String) AsBool

func (x String) AsBool() (bool, error)

func (String) AsBytes

func (x String) AsBytes() ([]byte, error)

func (String) AsFloat

func (x String) AsFloat() (float64, error)

func (String) AsInt

func (x String) AsInt() (int64, error)
func (x String) AsLink() (datamodel.Link, error)

func (String) IsAbsent added in v0.5.0

func (String) IsAbsent() bool

func (String) IsNull

func (String) IsNull() bool

func (String) Kind added in v0.7.0

func (String) Kind() datamodel.Kind

func (String) Length

func (String) Length() int64

func (String) ListIterator

func (String) ListIterator() datamodel.ListIterator

func (String) LookupByIndex added in v0.5.0

func (x String) LookupByIndex(idx int64) (datamodel.Node, error)

func (String) LookupByNode added in v0.5.0

func (x String) LookupByNode(key datamodel.Node) (datamodel.Node, error)

func (String) LookupBySegment added in v0.5.0

func (x String) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error)

func (String) LookupByString added in v0.5.0

func (x String) LookupByString(string) (datamodel.Node, error)

func (String) MapIterator

func (String) MapIterator() datamodel.MapIterator

type StringAssembler

type StringAssembler struct {
	TypeName string
}

StringAssembler has similar purpose as String, but for (you guessed it) the NodeAssembler interface rather than the Node interface.

func (StringAssembler) AssignBool

func (x StringAssembler) AssignBool(bool) error

func (StringAssembler) AssignBytes

func (x StringAssembler) AssignBytes([]byte) error

func (StringAssembler) AssignFloat

func (x StringAssembler) AssignFloat(float64) error

func (StringAssembler) AssignInt

func (x StringAssembler) AssignInt(int64) error
func (x StringAssembler) AssignLink(datamodel.Link) error

func (StringAssembler) AssignNull

func (x StringAssembler) AssignNull() error

func (StringAssembler) BeginList

func (x StringAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error)

func (StringAssembler) BeginMap

func (x StringAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error)

Jump to

Keyboard shortcuts

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