execs

package
v0.0.0-...-7f3ebcf Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2023 License: MIT Imports: 0 Imported by: 2

Documentation

Index

Constants

View Source
const (
	ParamTypeEmail = iota + 7
	ParamTypePhone
	ParamTypePassword
	ParamTypeURL
)

Hints; should be strings

View Source
const (
	// Type of array is being specified by adding ParamType,
	// e.g. ParamTypeArray + ParamTypeInt indicates array of integers ([]int)
	ParamTypeArray = 0x2A

	// Because it's hard to specify map types with enums, there's only
	// type for map[string]type. As in ParamTypeArray, type of value
	// is being specified by adding ParamType,
	// e.g. ParamTypeMap + ParamTypeInt indicates map with string keys and
	// int values (map[string]int)
	ParamTypeStringMap = 0x6A
)

Composite types

View Source
const (
	ExecTypeEmpty = ExecutorType("")
)
View Source
const ParamTypeAny = 0xFF

Right anything.

Variables

View Source
var ActionExecutors = map[ExecutorType]Executor{
	ExecTypeEmpty: PassExecutor{},
}

Functions

This section is empty.

Types

type Executor

type Executor interface {
	Run(Params) error
	Type() ExecutorType
	ParamsList() Params
	CheckValid(Params) (bool, string)
}

Executor interface wraps all possible action executors

type ExecutorType

type ExecutorType string

ExecutorType shows type of Executor

type Func

type Func = func(Params) error

type Param

type Param struct {
	Type  ParamType   `json:"type" bson:"type"`
	Value interface{} `json:"value" bson:"value"`
}

type ParamType

type ParamType uint8
const (
	ParamTypeNull ParamType = iota
	ParamTypeInt
	ParamTypeString
	ParamTypeBool
	ParamTypeFloat
	ParamTypeByte

	// String datetime encoded in RFC 3339 format
	// Tip: you can use time.RFC3339
	ParamTypeDateTime
)

Primitive types

type Params

type Params = map[string]Param

type PassExecutor

type PassExecutor struct{}

func (PassExecutor) CheckValid

func (PassExecutor) CheckValid(Params) (bool, string)

func (PassExecutor) ParamsList

func (PassExecutor) ParamsList() Params

func (PassExecutor) Run

func (PassExecutor) Run(Params) error

func (PassExecutor) Type

func (PassExecutor) Type() ExecutorType

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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