resourceid

package
v0.9.5 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeModuleID added in v0.9.4

func DecodeModuleID(id string, expectedTypeName string) (any, error)

DecodeModule base64-decodes and JSON unmarshals an ID, returning the module typename and its data.

func Encode

func Encode[T any, I ID[T]](payload *T) (I, error)

Encode JSON marshals and base64-encodes an arbitrary payload.

func EncodeModule added in v0.9.4

func EncodeModule(typeName string, value any) (string, error)

EncodeModule JSON marshals and base64-encodes a module ID from its typename and data.

func TypeName added in v0.8.8

func TypeName(id string) (string, error)

Types

type Digestible added in v0.8.8

type Digestible interface {
	Digest() (digest.Digest, error)
}

Digestible is any object which can return a digest of its content.

It is used to record the request's result as an output of the request's vertex in the progress stream.

type ID added in v0.8.8

type ID[T any] string

func (ID[T]) Decode added in v0.8.8

func (id ID[T]) Decode() (*T, error)

Decode base64-decodes and JSON unmarshals an ID into the object T

func (ID[T]) Digest added in v0.8.8

func (id ID[T]) Digest() (digest.Digest, error)

func (ID[T]) ResourceTypeName added in v0.8.8

func (id ID[T]) ResourceTypeName() string

func (ID[T]) String added in v0.8.8

func (id ID[T]) String() string

func (ID[T]) Validate added in v0.9.4

func (id ID[T]) Validate() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
JackTT - Gopher 🇻🇳