Documentation ¶
Overview ¶
Copyright © 2022 Kaleido, Inc.
SPDX-License-Identifier: Apache-2.0
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func FFEnumValues(t string) []interface{}
- func NewFFISchemaCompiler() *jsonschema.Compiler
- func ParseToByteSize(byteString string) int64
- func ParseToDuration(durationString string) time.Duration
- func SafeHashCompare(h1 *Bytes32, h2 *Bytes32) bool
- func ShortID() string
- func ToStringArray(unknown interface{}) ([]string, bool)
- func TypeNamespaceNameTopicHash(objType string, ns string, name string) string
- func ValidateFFNameField(ctx context.Context, str string, fieldName string) error
- func ValidateFFNameFieldNoUUID(ctx context.Context, str string, fieldName string) error
- func ValidateLength(ctx context.Context, str string, fieldName string, max int) error
- func ValidateSafeCharsOnly(ctx context.Context, str string, fieldName string) error
- type AuthReq
- type BaseFFIParamValidator
- type Bytes32
- type ConfigRecord
- type FFBigInt
- func (i *FFBigInt) Equals(i2 *FFBigInt) bool
- func (i *FFBigInt) Int() *big.Int
- func (i *FFBigInt) Int64() int64
- func (i FFBigInt) MarshalText() ([]byte, error)
- func (i *FFBigInt) Scan(src interface{}) error
- func (i *FFBigInt) Uint64() uint64
- func (i *FFBigInt) UnmarshalJSON(b []byte) error
- func (i FFBigInt) Value() (driver.Value, error)
- type FFDuration
- type FFEnum
- type FFI
- type FFIEvent
- type FFIEventDefinition
- type FFIGenerationRequest
- type FFIMethod
- type FFIParam
- type FFIParamValidator
- type FFIParams
- type FFIReference
- type FFTime
- func (ft *FFTime) Equal(ft2 *FFTime) bool
- func (ft *FFTime) MarshalJSON() ([]byte, error)
- func (ft *FFTime) Scan(src interface{}) error
- func (ft FFTime) String() string
- func (ft *FFTime) Time() *time.Time
- func (ft *FFTime) UnixNano() int64
- func (ft *FFTime) UnmarshalText(b []byte) error
- func (ft FFTime) Value() (driver.Value, error)
- type HexUUID
- type JSONAny
- func (h *JSONAny) Bytes() []byte
- func (h *JSONAny) Hash() *Bytes32
- func (h *JSONAny) IsNil() bool
- func (h *JSONAny) JSONObject() JSONObject
- func (h *JSONAny) JSONObjectArray() JSONObjectArray
- func (h *JSONAny) JSONObjectArrayOk(noWarn ...bool) (JSONObjectArray, bool)
- func (h *JSONAny) JSONObjectNowarn() JSONObject
- func (h *JSONAny) JSONObjectOk(noWarn ...bool) (JSONObject, bool)
- func (h *JSONAny) Length() int64
- func (h JSONAny) MarshalJSON() ([]byte, error)
- func (h *JSONAny) Scan(src interface{}) error
- func (h *JSONAny) String() string
- func (h *JSONAny) Unmarshal(ctx context.Context, v interface{}) error
- func (h *JSONAny) UnmarshalJSON(b []byte) error
- func (h *JSONAny) Value() (driver.Value, error)
- type JSONObject
- func (jd JSONObject) GetBool(key string) bool
- func (jd JSONObject) GetInt64(key string) int64
- func (jd JSONObject) GetInteger(key string) *big.Int
- func (jd JSONObject) GetObject(key string) JSONObject
- func (jd JSONObject) GetObjectArray(key string) JSONObjectArray
- func (jd JSONObject) GetObjectArrayOk(key string) (JSONObjectArray, bool)
- func (jd JSONObject) GetObjectOk(key string) (JSONObject, bool)
- func (jd JSONObject) GetString(key string) string
- func (jd JSONObject) GetStringArray(key string) []string
- func (jd JSONObject) GetStringArrayOk(key string) ([]string, bool)
- func (jd JSONObject) GetStringOk(key string) (string, bool)
- func (jd JSONObject) Hash(jsonDesc string) (*Bytes32, error)
- func (jd *JSONObject) Scan(src interface{}) error
- func (jd JSONObject) String() string
- func (jd JSONObject) Value() (driver.Value, error)
- type JSONObjectArray
- type RESTError
- type UUID
- func (u *UUID) Equals(u2 *UUID) bool
- func (u *UUID) HashBucket(buckets int) int
- func (u UUID) MarshalBinary() ([]byte, error)
- func (u UUID) MarshalText() ([]byte, error)
- func (u *UUID) Scan(src interface{}) error
- func (u *UUID) String() string
- func (u *UUID) UnmarshalBinary(b []byte) error
- func (u *UUID) UnmarshalText(b []byte) error
- func (u *UUID) Value() (driver.Value, error)
Constants ¶
const MaxFFBigIntHexLength = 65
const (
NullString = "null"
)
const (
// ShortIDlphabet is designed for easy double-click select
ShortIDlphabet = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz"
)
Variables ¶
This section is empty.
Functions ¶
func FFEnumValues ¶ added in v0.1.7
func FFEnumValues(t string) []interface{}
func NewFFISchemaCompiler ¶ added in v0.1.11
func NewFFISchemaCompiler() *jsonschema.Compiler
func ParseToByteSize ¶
ParseToByteSize is a standard handling of a number of bytes, in config or API options
func ParseToDuration ¶
ParseToDuration is a standard handling of any duration string, in config or API options
func SafeHashCompare ¶
func ToStringArray ¶
func TypeNamespaceNameTopicHash ¶ added in v0.1.11
func ValidateFFNameField ¶ added in v0.1.11
func ValidateFFNameFieldNoUUID ¶ added in v0.1.11
func ValidateLength ¶ added in v0.1.11
Types ¶
type BaseFFIParamValidator ¶ added in v0.1.11
type BaseFFIParamValidator struct{}
func (BaseFFIParamValidator) Compile ¶ added in v0.1.11
func (v BaseFFIParamValidator) Compile(ctx jsonschema.CompilerContext, m map[string]interface{}) (jsonschema.ExtSchema, error)
func (*BaseFFIParamValidator) GetExtensionName ¶ added in v0.1.11
func (v *BaseFFIParamValidator) GetExtensionName() string
func (*BaseFFIParamValidator) GetMetaSchema ¶ added in v0.1.11
func (v *BaseFFIParamValidator) GetMetaSchema() *jsonschema.Schema
type Bytes32 ¶
type Bytes32 [32]byte
Bytes32 is a holder of a hash, that can be used to correlate onchain data with off-chain data.
func HashResult ¶
func HashString ¶
func MustParseBytes32 ¶
func NewRandB32 ¶
func NewRandB32() *Bytes32
func (Bytes32) MarshalText ¶
func (*Bytes32) UnmarshalText ¶
type ConfigRecord ¶
type FFBigInt ¶
FFBigInt is a wrapper on a Go big.Int that standardizes JSON and DB serialization
func NewFFBigInt ¶
func (FFBigInt) MarshalText ¶
func (*FFBigInt) UnmarshalJSON ¶
type FFDuration ¶
FFDuration is serialized to JSON in the string format of time.Duration It can be unmarshalled from a number, or a string. - If it is a string in time.Duration format, that will be used - If it is a string that can be parsed as an int64, that will be used in Milliseconds - If it is a number, that will be used in Milliseconds
func ParseDurationString ¶
func ParseDurationString(durationString string, def time.Duration) (FFDuration, error)
ParseDurationString is a standard handling of any duration string, in config or API options
func (*FFDuration) MarshalJSON ¶
func (fd *FFDuration) MarshalJSON() ([]byte, error)
func (*FFDuration) Scan ¶
func (fd *FFDuration) Scan(src interface{}) error
Scan implements sql.Scanner
func (*FFDuration) String ¶
func (fd *FFDuration) String() string
func (*FFDuration) UnmarshalJSON ¶
func (fd *FFDuration) UnmarshalJSON(b []byte) error
type FFEnum ¶ added in v0.1.7
type FFEnum string
func FFEnumValue ¶ added in v0.1.7
func (*FFEnum) UnmarshalText ¶ added in v0.1.7
type FFI ¶ added in v0.1.11
type FFI struct { ID *UUID `ffstruct:"FFI" json:"id,omitempty" ffexcludeinput:"true"` Message *UUID `ffstruct:"FFI" json:"message,omitempty" ffexcludeinput:"true"` Namespace string `ffstruct:"FFI" json:"namespace,omitempty" ffexcludeinput:"true"` Name string `ffstruct:"FFI" json:"name"` Description string `ffstruct:"FFI" json:"description"` Version string `ffstruct:"FFI" json:"version"` Methods []*FFIMethod `ffstruct:"FFI" json:"methods,omitempty"` Events []*FFIEvent `ffstruct:"FFI" json:"events,omitempty"` }
func (*FFI) SetBroadcastMessage ¶ added in v0.1.11
type FFIEvent ¶ added in v0.1.11
type FFIEvent struct { ID *UUID `ffstruct:"FFIEvent" json:"id,omitempty" ffexcludeinput:"true"` Interface *UUID `ffstruct:"FFIEvent" json:"interface,omitempty" ffexcludeinput:"true"` Namespace string `ffstruct:"FFIEvent" json:"namespace,omitempty" ffexcludeinput:"true"` Pathname string `ffstruct:"FFIEvent" json:"pathname,omitempty" ffexcludeinput:"true"` Signature string `ffstruct:"FFIEvent" json:"signature" ffexcludeinput:"true"` FFIEventDefinition }
type FFIEventDefinition ¶ added in v0.1.11
type FFIEventDefinition struct { Name string `ffstruct:"FFIEvent" json:"name"` Description string `ffstruct:"FFIEvent" json:"description"` Params FFIParams `ffstruct:"FFIEvent" json:"params"` Details JSONObject `ffstruct:"FFIEvent" json:"details,omitempty"` }
type FFIGenerationRequest ¶ added in v0.1.11
type FFIGenerationRequest struct { Namespace string `ffstruct:"FFIGenerationRequest" json:"namespace,omitempty"` Name string `ffstruct:"FFIGenerationRequest" json:"name"` Description string `ffstruct:"FFIGenerationRequest" json:"description"` Version string `ffstruct:"FFIGenerationRequest" json:"version"` Input *JSONAny `ffstruct:"FFIGenerationRequest" json:"input"` }
type FFIMethod ¶ added in v0.1.11
type FFIMethod struct { ID *UUID `ffstruct:"FFIMethod" json:"id,omitempty" ffexcludeinput:"true"` Interface *UUID `ffstruct:"FFIMethod" json:"interface,omitempty" ffexcludeinput:"true"` Name string `ffstruct:"FFIMethod" json:"name"` Namespace string `ffstruct:"FFIMethod" json:"namespace,omitempty" ffexcludeinput:"true"` Pathname string `ffstruct:"FFIMethod" json:"pathname" ffexcludeinput:"true"` Description string `ffstruct:"FFIMethod" json:"description"` Params FFIParams `ffstruct:"FFIMethod" json:"params"` Returns FFIParams `ffstruct:"FFIMethod" json:"returns"` Details JSONObject `ffstruct:"FFIMethod" json:"details,omitempty"` }
type FFIParamValidator ¶ added in v0.1.11
type FFIParams ¶ added in v0.1.11
type FFIParams []*FFIParam
type FFIReference ¶ added in v0.1.11
type FFTime ¶
FFTime is serialized to JSON on the API in RFC3339 nanosecond UTC time (noting that JavaScript can parse this format happily into millisecond time with Date.pase()). It is persisted as a nanosecond resolution timestamp in the database. It can be parsed from RFC3339, or unix timestamps (second, millisecond or nanosecond resolution)
func ParseTimeString ¶
func (*FFTime) MarshalJSON ¶
func (*FFTime) UnmarshalText ¶
type HexUUID ¶
type HexUUID = Bytes32
HexUUID is 32 character ASCII string containing the hex representation of UUID, with the dashes of the canonical representation removed
type JSONAny ¶
type JSONAny string
JSONAny uses raw encode/decode to preserve field order, and can handle any types of field. It validates the JSON can be unmarshalled, but does not change the order. It does however trim out whitespace
func JSONAnyPtr ¶
func JSONAnyPtrBytes ¶
func (*JSONAny) JSONObject ¶
func (h *JSONAny) JSONObject() JSONObject
JSONObject attempts to de-serialize the contained structure as a JSON Object (map) Safe and will never return nil Will return an empty object if the type is array, string, bool, number etc.
func (*JSONAny) JSONObjectArray ¶ added in v0.1.6
func (h *JSONAny) JSONObjectArray() JSONObjectArray
JSONObject attempts to de-serialize the contained structure an array of JSON objects
func (*JSONAny) JSONObjectArrayOk ¶ added in v0.1.6
func (h *JSONAny) JSONObjectArrayOk(noWarn ...bool) (JSONObjectArray, bool)
func (*JSONAny) JSONObjectNowarn ¶
func (h *JSONAny) JSONObjectNowarn() JSONObject
JSONObjectNowarn acts the same as JSONObject, but does not warn if the value cannot be parsed as an object
func (*JSONAny) JSONObjectOk ¶
func (h *JSONAny) JSONObjectOk(noWarn ...bool) (JSONObject, bool)
func (JSONAny) MarshalJSON ¶
func (*JSONAny) UnmarshalJSON ¶
type JSONObject ¶
type JSONObject map[string]interface{}
JSONObject is a holder of a hash, that can be used to correlate onchain data with off-chain data.
func (JSONObject) GetBool ¶
func (jd JSONObject) GetBool(key string) bool
func (JSONObject) GetInt64 ¶
func (jd JSONObject) GetInt64(key string) int64
func (JSONObject) GetInteger ¶
func (jd JSONObject) GetInteger(key string) *big.Int
func (JSONObject) GetObject ¶
func (jd JSONObject) GetObject(key string) JSONObject
func (JSONObject) GetObjectArray ¶
func (jd JSONObject) GetObjectArray(key string) JSONObjectArray
func (JSONObject) GetObjectArrayOk ¶
func (jd JSONObject) GetObjectArrayOk(key string) (JSONObjectArray, bool)
func (JSONObject) GetObjectOk ¶
func (jd JSONObject) GetObjectOk(key string) (JSONObject, bool)
func (JSONObject) GetString ¶
func (jd JSONObject) GetString(key string) string
func (JSONObject) GetStringArray ¶
func (jd JSONObject) GetStringArray(key string) []string
func (JSONObject) GetStringArrayOk ¶
func (jd JSONObject) GetStringArrayOk(key string) ([]string, bool)
func (JSONObject) GetStringOk ¶
func (jd JSONObject) GetStringOk(key string) (string, bool)
func (*JSONObject) Scan ¶
func (jd *JSONObject) Scan(src interface{}) error
Scan implements sql.Scanner
func (JSONObject) String ¶
func (jd JSONObject) String() string
type JSONObjectArray ¶
type JSONObjectArray []JSONObject
JSONObjectArray is an array of JSONObject
func ToJSONObjectArray ¶
func ToJSONObjectArray(unknown interface{}) (JSONObjectArray, bool)
func (*JSONObjectArray) Scan ¶
func (jd *JSONObjectArray) Scan(src interface{}) error
Scan implements sql.Scanner
func (JSONObjectArray) String ¶
func (jd JSONObjectArray) String() string
type UUID ¶
UUID is a wrapper on a UUID implementation, ensuring Value handles nil