model

package
v1.1.1481 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Get

func Get[V any](vars *ServerVars, key string) (V, error)

Get takes the desired return type as parameter and safely searches the map and returns the value if it is found and is of the desired type.

Types

type ServerVars

type ServerVars struct {
	Vals map[string]any
}

ServerVars manages server variables with a map of key-value pairs.

func NewServerVars

func NewServerVars() *ServerVars

NewServerVars creates and returns a new instance of Vars,

func (*ServerVars) Decode

func (vars *ServerVars) Decode(ctx context.Context, b []byte) error

Decode decodes a go binary object containing workflow variables.

func (*ServerVars) Encode

func (vars *ServerVars) Encode(ctx context.Context) ([]byte, error)

Encode encodes the map of workflow variables into a go binary to be sent across the wire.

func (*ServerVars) GetBool

func (vars *ServerVars) GetBool(key string) (bool, error)

GetBool validates that a key has an underlying value in the map[int]interface{} vars and safely returns the result.

func (*ServerVars) GetFloat64

func (vars *ServerVars) GetFloat64(key string) (float64, error)

GetFloat64 validates that a key has an underlying value in the map[int]interface{} vars and safely returns the result.

func (*ServerVars) GetInt64

func (vars *ServerVars) GetInt64(key string) (int64, error)

GetInt64 validates that a key has an underlying value in the map[int]interface{} vars and safely returns the result.

func (*ServerVars) GetString

func (vars *ServerVars) GetString(key string) (string, error)

GetString validates that a key has an underlying value in the map[string]interface{} vars and safely returns the result.

func (*ServerVars) Keys

func (vars *ServerVars) Keys() iter.Seq[string]

Keys returns a sequence of all keys present in the Vars map.

func (*ServerVars) Len

func (vars *ServerVars) Len() int

Len returns the number of key-value pairs in the Vals map of ServerVars.

func (*ServerVars) SetBool

func (vars *ServerVars) SetBool(key string, value bool)

SetBool sets a boolean value for the specified key in the Vars map.

func (*ServerVars) SetFloat64

func (vars *ServerVars) SetFloat64(key string, value float64)

SetFloat64 sets a float64 value for the specified key in the Vars map.

func (*ServerVars) SetInt64

func (vars *ServerVars) SetInt64(key string, value int64)

SetInt64 sets an int64 value for the specified key in the Vars map.

func (*ServerVars) SetString

func (vars *ServerVars) SetString(key string, value string)

SetString sets a string value for the specified key in the Vars map.

Jump to

Keyboard shortcuts

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