sdk

package
v0.78.3 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Call

func Call[Req, Resp any](ctx context.Context, verb Verb[Req, Resp], req Req) (resp Resp, err error)

Call a Verb through the FTL Controller.

Types

type DataRef

type DataRef struct {
	Module string `json:"module,omitempty"`
	Name   string `json:"name"`
}

DataRef is a reference to a Data type.

func DataRefFromProto

func DataRefFromProto(p *schemapb.DataRef) DataRef

func ParseDataRef

func ParseDataRef(ref string) (DataRef, error)

func (DataRef) String

func (v DataRef) String() string

func (DataRef) ToProto

func (v DataRef) ToProto() *schemapb.DataRef

func (*DataRef) UnmarshalText

func (v *DataRef) UnmarshalText(text []byte) error

type Option added in v0.78.0

type Option[T any] struct {
	// contains filtered or unexported fields
}

An Option type is a type that can contain a value or nothing.

func Nil added in v0.78.0

func Nil[T any](ptr T) Option[T]

Nil returns an Option that is invalid if the value is nil, otherwise the value.

If the type is not nillable (slice, map, chan, ptr, interface) this will panic.

func None added in v0.78.0

func None[T any]() Option[T]

None returns an Option that contains nothing.

func Ptr added in v0.78.0

func Ptr[T any](ptr *T) Option[T]

Ptr returns an Option that is invalid if the pointer is nil, otherwise the dereferenced pointer.

func Some added in v0.78.0

func Some[T any](value T) Option[T]

Some returns an Option that contains a value.

func Zero added in v0.78.0

func Zero[T any](value T) Option[T]

Zero returns an Option that is invalid if the value is the zero value, otherwise the value.

func (Option[T]) Default added in v0.78.0

func (o Option[T]) Default(value T) T

Default returns the Option value if it is present, otherwise it returns the value passed.

func (Option[T]) Get added in v0.78.0

func (o Option[T]) Get() (T, bool)

Get returns the value and a boolean indicating if the Option contains a value.

func (Option[T]) GoString added in v0.78.0

func (o Option[T]) GoString() string

func (Option[T]) MarshalJSON added in v0.78.0

func (o Option[T]) MarshalJSON() ([]byte, error)

func (Option[T]) MustGet added in v0.78.0

func (o Option[T]) MustGet() T

MustGet returns the value. It panics if the Option contains nothing.

func (Option[T]) Ok added in v0.78.0

func (o Option[T]) Ok() bool

Ok returns true if the Option contains a value.

func (Option[T]) Ptr added in v0.78.0

func (o Option[T]) Ptr() *T

Ptr returns a pointer to the value if the Option contains a value, otherwise nil.

func (*Option[T]) Scan added in v0.78.0

func (o *Option[T]) Scan(src any) error

func (Option[T]) String added in v0.78.0

func (o Option[T]) String() string

func (*Option[T]) UnmarshalJSON added in v0.78.0

func (o *Option[T]) UnmarshalJSON(data []byte) error

func (Option[T]) Value added in v0.78.0

func (o Option[T]) Value() (driver.Value, error)

type Sink

type Sink[Req any] func(context.Context, Req) error

A Sink is a function that can be called with an input and no output.

type Verb

type Verb[Req, Resp any] func(context.Context, Req) (Resp, error)

A Verb is a function that can be called with an input and an output.

type VerbRef

type VerbRef struct {
	Module string `json:"module,omitempty"`
	Name   string `json:"name"`
}

VerbRef is a reference to a Verb.

func ParseVerbRef

func ParseVerbRef(ref string) (VerbRef, error)

func ToVerbRef

func ToVerbRef[Req, Resp any](verb Verb[Req, Resp]) VerbRef

ToVerbRef returns the FTL reference for a Verb.

func VerbRefFromProto

func VerbRefFromProto(p *schemapb.VerbRef) VerbRef

func (VerbRef) String

func (v VerbRef) String() string

func (VerbRef) ToProto

func (v VerbRef) ToProto() *schemapb.VerbRef

func (*VerbRef) UnmarshalText

func (v *VerbRef) UnmarshalText(text []byte) error

Directories

Path Synopsis
Package kvstore provides a generic key-value store.
Package kvstore provides a generic key-value store.

Jump to

Keyboard shortcuts

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