Integrate BACKBEAT SDK and resolve KACHING license validation
Major integrations and fixes: - Added BACKBEAT SDK integration for P2P operation timing - Implemented beat-aware status tracking for distributed operations - Added Docker secrets support for secure license management - Resolved KACHING license validation via HTTPS/TLS - Updated docker-compose configuration for clean stack deployment - Disabled rollback policies to prevent deployment failures - Added license credential storage (CHORUS-DEV-MULTI-001) Technical improvements: - BACKBEAT P2P operation tracking with phase management - Enhanced configuration system with file-based secrets - Improved error handling for license validation - Clean separation of KACHING and CHORUS deployment stacks 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
37
vendor/github.com/ipld/go-ipld-prime/node/mixins/HACKME.md
generated
vendored
Normal file
37
vendor/github.com/ipld/go-ipld-prime/node/mixins/HACKME.md
generated
vendored
Normal file
@@ -0,0 +1,37 @@
|
||||
node mixins and how to use them
|
||||
===============================
|
||||
|
||||
These mixins are here to:
|
||||
|
||||
1. reduce the amount of code you need to write to create a new Node implementation, and
|
||||
2. standardize a lot of the error handling for common cases (especially, around kinds).
|
||||
|
||||
"Reduce the amount of code" also has an application in codegen,
|
||||
where while it doesn't save any human effort, it does reduce GLOC size.
|
||||
(Or more precisely, it doesn't save *lines*, since we use them in verbose style,
|
||||
but it does make those lines an awful lot shorter.)
|
||||
|
||||
Note that these mixins are _not_ particularly here to help with performance.
|
||||
|
||||
- all `ErrWrongKind` error are returned by value, which means a `runtime.convT2I` which means a heap allocation.
|
||||
The error paths will therefore never be "fast"; it will *always* be cheaper
|
||||
to check `kind` in advance than to probe and handle errors, if efficiency is your goal.
|
||||
- in general, there's really no way to improve upon the performance of having these methods simply writen directlyon your type.
|
||||
|
||||
These mixins will affect struct size if you use them via embed.
|
||||
They can also be used without any effect on struct size if used more verbosely.
|
||||
|
||||
The binary/assembly output size is not affected by use of the mixins.
|
||||
(If using them verbosely -- e.g. still declaring methods on your type
|
||||
and using `return mixins.Kind{"TypeName"}.Method()` in the method body --
|
||||
the end result is the inliner kicks in, and the end result is almost
|
||||
identical binary size.)
|
||||
|
||||
Summary:
|
||||
|
||||
- SLOC: good, or neutral depending on use
|
||||
- GLOC: good
|
||||
- standardized: good
|
||||
- speed: neutral
|
||||
- mem size: neutral if used verbosely, bad if used most tersely
|
||||
- asm size: neutral
|
||||
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/bool.go
generated
vendored
Normal file
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/bool.go
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
package mixins
|
||||
|
||||
import (
|
||||
"github.com/ipld/go-ipld-prime/datamodel"
|
||||
)
|
||||
|
||||
// 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.
|
||||
type Bool struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (Bool) Kind() datamodel.Kind {
|
||||
return datamodel.Kind_Bool
|
||||
}
|
||||
func (x Bool) LookupByString(string) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByString", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x Bool) LookupByNode(key datamodel.Node) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByNode", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x Bool) LookupByIndex(idx int64) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByIndex", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x Bool) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupBySegment", AppropriateKind: datamodel.KindSet_Recursive, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (Bool) MapIterator() datamodel.MapIterator {
|
||||
return nil
|
||||
}
|
||||
func (Bool) ListIterator() datamodel.ListIterator {
|
||||
return nil
|
||||
}
|
||||
func (Bool) Length() int64 {
|
||||
return -1
|
||||
}
|
||||
func (Bool) IsAbsent() bool {
|
||||
return false
|
||||
}
|
||||
func (Bool) IsNull() bool {
|
||||
return false
|
||||
}
|
||||
func (x Bool) AsInt() (int64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x Bool) AsFloat() (float64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x Bool) AsString() (string, error) {
|
||||
return "", datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x Bool) AsBytes() ([]byte, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x Bool) AsLink() (datamodel.Link, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
|
||||
// BoolAssembler has similar purpose as Bool, but for (you guessed it)
|
||||
// the NodeAssembler interface rather than the Node interface.
|
||||
type BoolAssembler struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (x BoolAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginMap", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x BoolAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginList", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x BoolAssembler) AssignNull() error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignNull", AppropriateKind: datamodel.KindSet_JustNull, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x BoolAssembler) AssignInt(int64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x BoolAssembler) AssignFloat(float64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x BoolAssembler) AssignString(string) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x BoolAssembler) AssignBytes([]byte) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
func (x BoolAssembler) AssignLink(datamodel.Link) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Bool}
|
||||
}
|
||||
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/bytes.go
generated
vendored
Normal file
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/bytes.go
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
package mixins
|
||||
|
||||
import (
|
||||
"github.com/ipld/go-ipld-prime/datamodel"
|
||||
)
|
||||
|
||||
// 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.
|
||||
type Bytes struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (Bytes) Kind() datamodel.Kind {
|
||||
return datamodel.Kind_Bytes
|
||||
}
|
||||
func (x Bytes) LookupByString(string) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByString", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x Bytes) LookupByNode(key datamodel.Node) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByNode", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x Bytes) LookupByIndex(idx int64) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByIndex", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x Bytes) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupBySegment", AppropriateKind: datamodel.KindSet_Recursive, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (Bytes) MapIterator() datamodel.MapIterator {
|
||||
return nil
|
||||
}
|
||||
func (Bytes) ListIterator() datamodel.ListIterator {
|
||||
return nil
|
||||
}
|
||||
func (Bytes) Length() int64 {
|
||||
return -1
|
||||
}
|
||||
func (Bytes) IsAbsent() bool {
|
||||
return false
|
||||
}
|
||||
func (Bytes) IsNull() bool {
|
||||
return false
|
||||
}
|
||||
func (x Bytes) AsBool() (bool, error) {
|
||||
return false, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x Bytes) AsInt() (int64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x Bytes) AsFloat() (float64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x Bytes) AsString() (string, error) {
|
||||
return "", datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x Bytes) AsLink() (datamodel.Link, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
|
||||
// BytesAssembler has similar purpose as Bytes, but for (you guessed it)
|
||||
// the NodeAssembler interface rather than the Node interface.
|
||||
type BytesAssembler struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (x BytesAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginMap", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x BytesAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginList", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x BytesAssembler) AssignNull() error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignNull", AppropriateKind: datamodel.KindSet_JustNull, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x BytesAssembler) AssignBool(bool) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x BytesAssembler) AssignInt(int64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x BytesAssembler) AssignFloat(float64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x BytesAssembler) AssignString(string) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
func (x BytesAssembler) AssignLink(datamodel.Link) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Bytes}
|
||||
}
|
||||
40
vendor/github.com/ipld/go-ipld-prime/node/mixins/delim.go
generated
vendored
Normal file
40
vendor/github.com/ipld/go-ipld-prime/node/mixins/delim.go
generated
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
package mixins
|
||||
|
||||
// This file is a little different than most of its siblings in this package.
|
||||
// It's not really much of a "mixin". More of a util function junkdrawer.
|
||||
//
|
||||
// Implementations of Data Model Nodes are unlikely to need these.
|
||||
// Implementations of Schema-level Node *are* likely to need these, however.
|
||||
//
|
||||
// Our codegen implementation emits calls to these functions.
|
||||
// (And having these functions in a package that's already an unconditional
|
||||
// import in files emitted by codegen makes the codegen significantly simpler.)
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// 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 SplitExact(s string, sep string, count int) ([]string, error) {
|
||||
ss := strings.Split(s, sep)
|
||||
if len(ss) != count {
|
||||
return nil, fmt.Errorf("expected %d instances of the delimiter, found %d", count-1, len(ss)-1)
|
||||
}
|
||||
return ss, nil
|
||||
}
|
||||
|
||||
// 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.
|
||||
func SplitN(s, sep string, n int) []string {
|
||||
return strings.SplitN(s, sep, n)
|
||||
}
|
||||
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/float.go
generated
vendored
Normal file
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/float.go
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
package mixins
|
||||
|
||||
import (
|
||||
"github.com/ipld/go-ipld-prime/datamodel"
|
||||
)
|
||||
|
||||
// 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.
|
||||
type Float struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (Float) Kind() datamodel.Kind {
|
||||
return datamodel.Kind_Float
|
||||
}
|
||||
func (x Float) LookupByString(string) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByString", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x Float) LookupByNode(key datamodel.Node) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByNode", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x Float) LookupByIndex(idx int64) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByIndex", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x Float) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupBySegment", AppropriateKind: datamodel.KindSet_Recursive, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (Float) MapIterator() datamodel.MapIterator {
|
||||
return nil
|
||||
}
|
||||
func (Float) ListIterator() datamodel.ListIterator {
|
||||
return nil
|
||||
}
|
||||
func (Float) Length() int64 {
|
||||
return -1
|
||||
}
|
||||
func (Float) IsAbsent() bool {
|
||||
return false
|
||||
}
|
||||
func (Float) IsNull() bool {
|
||||
return false
|
||||
}
|
||||
func (x Float) AsBool() (bool, error) {
|
||||
return false, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x Float) AsInt() (int64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x Float) AsString() (string, error) {
|
||||
return "", datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x Float) AsBytes() ([]byte, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x Float) AsLink() (datamodel.Link, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
|
||||
// FloatAssembler has similar purpose as Float, but for (you guessed it)
|
||||
// the NodeAssembler interface rather than the Node interface.
|
||||
type FloatAssembler struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (x FloatAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginMap", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x FloatAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginList", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x FloatAssembler) AssignNull() error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignNull", AppropriateKind: datamodel.KindSet_JustNull, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x FloatAssembler) AssignBool(bool) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x FloatAssembler) AssignInt(int64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x FloatAssembler) AssignString(string) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x FloatAssembler) AssignBytes([]byte) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
func (x FloatAssembler) AssignLink(datamodel.Link) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Float}
|
||||
}
|
||||
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/int.go
generated
vendored
Normal file
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/int.go
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
package mixins
|
||||
|
||||
import (
|
||||
"github.com/ipld/go-ipld-prime/datamodel"
|
||||
)
|
||||
|
||||
// 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.
|
||||
type Int struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (Int) Kind() datamodel.Kind {
|
||||
return datamodel.Kind_Int
|
||||
}
|
||||
func (x Int) LookupByString(string) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByString", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x Int) LookupByNode(key datamodel.Node) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByNode", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x Int) LookupByIndex(idx int64) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByIndex", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x Int) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupBySegment", AppropriateKind: datamodel.KindSet_Recursive, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (Int) MapIterator() datamodel.MapIterator {
|
||||
return nil
|
||||
}
|
||||
func (Int) ListIterator() datamodel.ListIterator {
|
||||
return nil
|
||||
}
|
||||
func (Int) Length() int64 {
|
||||
return -1
|
||||
}
|
||||
func (Int) IsAbsent() bool {
|
||||
return false
|
||||
}
|
||||
func (Int) IsNull() bool {
|
||||
return false
|
||||
}
|
||||
func (x Int) AsBool() (bool, error) {
|
||||
return false, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x Int) AsFloat() (float64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x Int) AsString() (string, error) {
|
||||
return "", datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x Int) AsBytes() ([]byte, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x Int) AsLink() (datamodel.Link, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
|
||||
// IntAssembler has similar purpose as Int, but for (you guessed it)
|
||||
// the NodeAssembler interface rather than the Node interface.
|
||||
type IntAssembler struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (x IntAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginMap", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x IntAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginList", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x IntAssembler) AssignNull() error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignNull", AppropriateKind: datamodel.KindSet_JustNull, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x IntAssembler) AssignBool(bool) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x IntAssembler) AssignFloat(float64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x IntAssembler) AssignString(string) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x IntAssembler) AssignBytes([]byte) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
func (x IntAssembler) AssignLink(datamodel.Link) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Int}
|
||||
}
|
||||
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/link.go
generated
vendored
Normal file
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/link.go
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
package mixins
|
||||
|
||||
import (
|
||||
"github.com/ipld/go-ipld-prime/datamodel"
|
||||
)
|
||||
|
||||
// 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.
|
||||
type Link struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (Link) Kind() datamodel.Kind {
|
||||
return datamodel.Kind_Link
|
||||
}
|
||||
func (x Link) LookupByString(string) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByString", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x Link) LookupByNode(key datamodel.Node) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByNode", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x Link) LookupByIndex(idx int64) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByIndex", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x Link) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupBySegment", AppropriateKind: datamodel.KindSet_Recursive, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (Link) MapIterator() datamodel.MapIterator {
|
||||
return nil
|
||||
}
|
||||
func (Link) ListIterator() datamodel.ListIterator {
|
||||
return nil
|
||||
}
|
||||
func (Link) Length() int64 {
|
||||
return -1
|
||||
}
|
||||
func (Link) IsAbsent() bool {
|
||||
return false
|
||||
}
|
||||
func (Link) IsNull() bool {
|
||||
return false
|
||||
}
|
||||
func (x Link) AsBool() (bool, error) {
|
||||
return false, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x Link) AsInt() (int64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x Link) AsFloat() (float64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x Link) AsString() (string, error) {
|
||||
return "", datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x Link) AsBytes() ([]byte, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
|
||||
// LinkAssembler has similar purpose as Link, but for (you guessed it)
|
||||
// the NodeAssembler interface rather than the Node interface.
|
||||
type LinkAssembler struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (x LinkAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginMap", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x LinkAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginList", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x LinkAssembler) AssignNull() error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignNull", AppropriateKind: datamodel.KindSet_JustNull, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x LinkAssembler) AssignBool(bool) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x LinkAssembler) AssignInt(int64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x LinkAssembler) AssignFloat(float64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x LinkAssembler) AssignString(string) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
func (x LinkAssembler) AssignBytes([]byte) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Link}
|
||||
}
|
||||
88
vendor/github.com/ipld/go-ipld-prime/node/mixins/list.go
generated
vendored
Normal file
88
vendor/github.com/ipld/go-ipld-prime/node/mixins/list.go
generated
vendored
Normal file
@@ -0,0 +1,88 @@
|
||||
package mixins
|
||||
|
||||
import (
|
||||
"github.com/ipld/go-ipld-prime/datamodel"
|
||||
)
|
||||
|
||||
// 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.
|
||||
type List struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (List) Kind() datamodel.Kind {
|
||||
return datamodel.Kind_List
|
||||
}
|
||||
func (x List) LookupByString(string) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByString", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x List) LookupByNode(key datamodel.Node) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByNode", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (List) MapIterator() datamodel.MapIterator {
|
||||
return nil
|
||||
}
|
||||
func (List) IsAbsent() bool {
|
||||
return false
|
||||
}
|
||||
func (List) IsNull() bool {
|
||||
return false
|
||||
}
|
||||
func (x List) AsBool() (bool, error) {
|
||||
return false, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x List) AsInt() (int64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x List) AsFloat() (float64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x List) AsString() (string, error) {
|
||||
return "", datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x List) AsBytes() ([]byte, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x List) AsLink() (datamodel.Link, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
|
||||
// ListAssembler has similar purpose as List, but for (you guessed it)
|
||||
// the NodeAssembler interface rather than the Node interface.
|
||||
type ListAssembler struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (x ListAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginMap", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x ListAssembler) AssignNull() error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignNull", AppropriateKind: datamodel.KindSet_JustNull, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x ListAssembler) AssignBool(bool) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x ListAssembler) AssignInt(int64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x ListAssembler) AssignFloat(float64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x ListAssembler) AssignString(string) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x ListAssembler) AssignBytes([]byte) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
func (x ListAssembler) AssignLink(datamodel.Link) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_List}
|
||||
}
|
||||
85
vendor/github.com/ipld/go-ipld-prime/node/mixins/map.go
generated
vendored
Normal file
85
vendor/github.com/ipld/go-ipld-prime/node/mixins/map.go
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
package mixins
|
||||
|
||||
import (
|
||||
"github.com/ipld/go-ipld-prime/datamodel"
|
||||
)
|
||||
|
||||
// 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.
|
||||
type Map struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (Map) Kind() datamodel.Kind {
|
||||
return datamodel.Kind_Map
|
||||
}
|
||||
func (x Map) LookupByIndex(idx int64) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByIndex", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (Map) ListIterator() datamodel.ListIterator {
|
||||
return nil
|
||||
}
|
||||
func (Map) IsAbsent() bool {
|
||||
return false
|
||||
}
|
||||
func (Map) IsNull() bool {
|
||||
return false
|
||||
}
|
||||
func (x Map) AsBool() (bool, error) {
|
||||
return false, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x Map) AsInt() (int64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x Map) AsFloat() (float64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x Map) AsString() (string, error) {
|
||||
return "", datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x Map) AsBytes() ([]byte, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x Map) AsLink() (datamodel.Link, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
|
||||
// MapAssembler has similar purpose as Map, but for (you guessed it)
|
||||
// the NodeAssembler interface rather than the Node interface.
|
||||
type MapAssembler struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (x MapAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginList", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x MapAssembler) AssignNull() error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignNull", AppropriateKind: datamodel.KindSet_JustNull, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x MapAssembler) AssignBool(bool) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x MapAssembler) AssignInt(int64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x MapAssembler) AssignFloat(float64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x MapAssembler) AssignString(string) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignString", AppropriateKind: datamodel.KindSet_JustString, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x MapAssembler) AssignBytes([]byte) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
func (x MapAssembler) AssignLink(datamodel.Link) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_Map}
|
||||
}
|
||||
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/string.go
generated
vendored
Normal file
97
vendor/github.com/ipld/go-ipld-prime/node/mixins/string.go
generated
vendored
Normal file
@@ -0,0 +1,97 @@
|
||||
package mixins
|
||||
|
||||
import (
|
||||
"github.com/ipld/go-ipld-prime/datamodel"
|
||||
)
|
||||
|
||||
// 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.
|
||||
type String struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (String) Kind() datamodel.Kind {
|
||||
return datamodel.Kind_String
|
||||
}
|
||||
func (x String) LookupByString(string) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByString", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x String) LookupByNode(key datamodel.Node) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByNode", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x String) LookupByIndex(idx int64) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByIndex", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x String) LookupBySegment(datamodel.PathSegment) (datamodel.Node, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupBySegment", AppropriateKind: datamodel.KindSet_Recursive, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (String) MapIterator() datamodel.MapIterator {
|
||||
return nil
|
||||
}
|
||||
func (String) ListIterator() datamodel.ListIterator {
|
||||
return nil
|
||||
}
|
||||
func (String) Length() int64 {
|
||||
return -1
|
||||
}
|
||||
func (String) IsAbsent() bool {
|
||||
return false
|
||||
}
|
||||
func (String) IsNull() bool {
|
||||
return false
|
||||
}
|
||||
func (x String) AsBool() (bool, error) {
|
||||
return false, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x String) AsInt() (int64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x String) AsFloat() (float64, error) {
|
||||
return 0, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x String) AsBytes() ([]byte, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x String) AsLink() (datamodel.Link, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
|
||||
// StringAssembler has similar purpose as String, but for (you guessed it)
|
||||
// the NodeAssembler interface rather than the Node interface.
|
||||
type StringAssembler struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (x StringAssembler) BeginMap(sizeHint int64) (datamodel.MapAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginMap", AppropriateKind: datamodel.KindSet_JustMap, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x StringAssembler) BeginList(sizeHint int64) (datamodel.ListAssembler, error) {
|
||||
return nil, datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginList", AppropriateKind: datamodel.KindSet_JustList, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x StringAssembler) AssignNull() error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignNull", AppropriateKind: datamodel.KindSet_JustNull, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x StringAssembler) AssignBool(bool) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBool", AppropriateKind: datamodel.KindSet_JustBool, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x StringAssembler) AssignInt(int64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignInt", AppropriateKind: datamodel.KindSet_JustInt, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x StringAssembler) AssignFloat(float64) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignFloat", AppropriateKind: datamodel.KindSet_JustFloat, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x StringAssembler) AssignBytes([]byte) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBytes", AppropriateKind: datamodel.KindSet_JustBytes, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
func (x StringAssembler) AssignLink(datamodel.Link) error {
|
||||
return datamodel.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignLink", AppropriateKind: datamodel.KindSet_JustLink, ActualKind: datamodel.Kind_String}
|
||||
}
|
||||
107
vendor/github.com/ipld/go-ipld-prime/node/mixins/tmplMixin.txt
generated
vendored
Normal file
107
vendor/github.com/ipld/go-ipld-prime/node/mixins/tmplMixin.txt
generated
vendored
Normal file
@@ -0,0 +1,107 @@
|
||||
// copy this and remove methods that aren't relevant to your kind.
|
||||
// this has not been scripted.
|
||||
// (the first part is trivial; the second part is not; and this updates rarely. https://xkcd.com/1205/ applies.)
|
||||
|
||||
package mixins
|
||||
|
||||
import (
|
||||
"github.com/ipld/go-ipld-prime/datamodel"
|
||||
)
|
||||
|
||||
// @Kind@ 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.
|
||||
type @Kind@ struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (@Kind@) Kind() ipld.Kind {
|
||||
return ipld.Kind_@Kind@
|
||||
}
|
||||
func (x @Kind@) LookupByString(string) (ipld.Node, error) {
|
||||
return nil, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByString", AppropriateKind: ipld.KindSet_JustMap, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@) LookupByNode(key ipld.Node) (ipld.Node, error) {
|
||||
return nil, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByNode", AppropriateKind: ipld.KindSet_JustMap, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@) LookupByIndex(idx int) (ipld.Node, error) {
|
||||
return nil, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupByIndex", AppropriateKind: ipld.KindSet_JustList, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@) LookupBySegment(ipld.PathSegment) (ipld.Node, error) {
|
||||
return nil, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "LookupBySegment", AppropriateKind: ipld.KindSet_Recursive, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (@Kind@) MapIterator() ipld.MapIterator {
|
||||
return nil
|
||||
}
|
||||
func (@Kind@) ListIterator() ipld.ListIterator {
|
||||
return nil
|
||||
}
|
||||
func (@Kind@) Length() int {
|
||||
return -1
|
||||
}
|
||||
func (@Kind@) IsAbsent() bool {
|
||||
return false
|
||||
}
|
||||
func (@Kind@) IsNull() bool {
|
||||
return false
|
||||
}
|
||||
func (x @Kind@) AsBool() (bool, error) {
|
||||
return false, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBool", AppropriateKind: ipld.KindSet_JustBool, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@) AsInt() (int, error) {
|
||||
return 0, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsInt", AppropriateKind: ipld.KindSet_JustInt, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@) AsFloat() (float64, error) {
|
||||
return 0, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsFloat", AppropriateKind: ipld.KindSet_JustFloat, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@) AsString() (string, error) {
|
||||
return "", ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsString", AppropriateKind: ipld.KindSet_JustString, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@) AsBytes() ([]byte, error) {
|
||||
return nil, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsBytes", AppropriateKind: ipld.KindSet_JustBytes, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@) AsLink() (ipld.Link, error) {
|
||||
return nil, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AsLink", AppropriateKind: ipld.KindSet_JustLink, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
|
||||
// @Kind@Assembler has similar purpose as @Kind@, but for (you guessed it)
|
||||
// the NodeAssembler interface rather than the Node interface.
|
||||
type @Kind@Assembler struct {
|
||||
TypeName string
|
||||
}
|
||||
|
||||
func (x @Kind@Assembler) BeginMap(sizeHint int) (ipld.MapAssembler, error) {
|
||||
return nil, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginMap", AppropriateKind: ipld.KindSet_JustMap, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@Assembler) BeginList(sizeHint int) (ipld.ListAssembler, error) {
|
||||
return nil, ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "BeginList", AppropriateKind: ipld.KindSet_JustList, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@Assembler) AssignNull() error {
|
||||
return ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignNull", AppropriateKind: ipld.KindSet_JustNull, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@Assembler) AssignBool(bool) error {
|
||||
return ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBool", AppropriateKind: ipld.KindSet_JustBool, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@Assembler) AssignInt(int) error {
|
||||
return ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignInt", AppropriateKind: ipld.KindSet_JustInt, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@Assembler) AssignFloat(float64) error {
|
||||
return ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignFloat", AppropriateKind: ipld.KindSet_JustFloat, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@Assembler) AssignString(string) error {
|
||||
return ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignString", AppropriateKind: ipld.KindSet_JustString, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@Assembler) AssignBytes([]byte) error {
|
||||
return ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignBytes", AppropriateKind: ipld.KindSet_JustBytes, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
func (x @Kind@Assembler) AssignLink(ipld.Link) error {
|
||||
return ipld.ErrWrongKind{TypeName: x.TypeName, MethodName: "AssignLink", AppropriateKind: ipld.KindSet_JustLink, ActualKind: ipld.Kind_@Kind@}
|
||||
}
|
||||
Reference in New Issue
Block a user