functiondefault

package
v0.0.0-...-49e5460 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	UUID4Type    FunctionDefaultType = "uuid4"
	RandomType                       = "random"
	KSUIDType                        = "ksuid"
	SequenceType                     = "sequence"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FunctionDefault

type FunctionDefault interface {
	// Take any number of arguments from "kwargs"
	Init(args map[string]interface{}) error

	// Return a list of supported types
	SupportedTypes() []datamantype.DatamanType

	// NOTE: we allow this method to return an error because some services may require it
	// even though this is the case, all efforts should be made to avoid an error in the GetDefault
	// call-- as it will impact the data-path
	// Take the db/collection/field and the current record and return the value for the field
	// context is used to pass in timeouts etc. (since some functions will call remote services etc.)
	GetDefault(
		ctx context.Context,
		defaultType datamantype.DatamanType,

	) (interface{}, error)
}

type FunctionDefaultType

type FunctionDefaultType string

func (FunctionDefaultType) Get

type KSUID

type KSUID struct{}

Implementations

func (*KSUID) GetDefault

func (u *KSUID) GetDefault(ctx context.Context,
	defaultType datamantype.DatamanType,
) (interface{}, error)

func (*KSUID) Init

func (u *KSUID) Init(kwargs map[string]interface{}) error

func (*KSUID) SupportedTypes

func (u *KSUID) SupportedTypes() []datamantype.DatamanType

type Random

type Random struct{}

Implementations

func (*Random) GetDefault

func (u *Random) GetDefault(ctx context.Context,
	defaultType datamantype.DatamanType,
) (interface{}, error)

func (*Random) Init

func (u *Random) Init(kwargs map[string]interface{}) error

func (*Random) SupportedTypes

func (u *Random) SupportedTypes() []datamantype.DatamanType

type Sequence

type Sequence struct {
	// contains filtered or unexported fields
}

Implementations

func (*Sequence) GetDefault

func (s *Sequence) GetDefault(ctx context.Context, defaultType datamantype.DatamanType) (interface{}, error)

func (*Sequence) Init

func (s *Sequence) Init(kwargs map[string]interface{}) error

func (*Sequence) SupportedTypes

func (s *Sequence) SupportedTypes() []datamantype.DatamanType

type UUID4

type UUID4 struct{}

Implementations

func (*UUID4) GetDefault

func (u *UUID4) GetDefault(ctx context.Context,
	defaultType datamantype.DatamanType,
) (interface{}, error)

func (*UUID4) Init

func (u *UUID4) Init(kwargs map[string]interface{}) error

func (*UUID4) SupportedTypes

func (u *UUID4) SupportedTypes() []datamantype.DatamanType

Jump to

Keyboard shortcuts

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