rc_recipe

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2021 License: MIT Imports: 19 Imported by: 1

Documentation

Index

Constants

View Source
const (
	BasePackage = app.Pkg + "/recipe"
)

Variables

View Source
var (
	ErrorValueRestoreFailed = errors.New("value restore failed")
)

Functions

func Key

func Key(r Recipe) string

func NoCustomValues

func NoCustomValues(r Recipe)

Types

type AnnotatedRecipe

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

func (AnnotatedRecipe) Exec

func (AnnotatedRecipe) IsConsole

func (z AnnotatedRecipe) IsConsole() bool

func (AnnotatedRecipe) IsExperimental

func (z AnnotatedRecipe) IsExperimental() bool

func (AnnotatedRecipe) IsIrreversible

func (z AnnotatedRecipe) IsIrreversible() bool

func (AnnotatedRecipe) IsSecret

func (z AnnotatedRecipe) IsSecret() bool

func (AnnotatedRecipe) IsTransient

func (z AnnotatedRecipe) IsTransient() bool

func (AnnotatedRecipe) Preset

func (z AnnotatedRecipe) Preset()

func (AnnotatedRecipe) Seed

func (z AnnotatedRecipe) Seed() Recipe

func (AnnotatedRecipe) Test

type Annotation

type Annotation interface {
	Recipe

	// Returns seed Recipe of this annotation.
	Seed() Recipe

	// True if the recipe is not for general usage.
	IsSecret() bool

	// True if the recipe is not designed for non-console UI.
	IsConsole() bool

	// True if the recipe is in experimental phase.
	IsExperimental() bool

	// True if the operation is irreversible.
	IsIrreversible() bool

	// True if the operation is transient.
	IsTransient() bool
}

func NewAnnotated

func NewAnnotated(seed Recipe) Annotation

type Nop

type Nop struct {
}

func (Nop) Exec

func (z Nop) Exec(c app_control.Control) error

func (Nop) Preset

func (z Nop) Preset()

func (Nop) Test

func (z Nop) Test(c app_control.Control) error

type Preset

type Preset interface {
	Preset()
}

type Recipe

type Recipe interface {
	Preset
	Exec(c app_control.Control) error
	Test(c app_control.Control) error
}

type RemarkConsole

type RemarkConsole struct {
}

func (RemarkConsole) IsConsole

func (z RemarkConsole) IsConsole() bool

type RemarkExperimental

type RemarkExperimental struct {
}

func (RemarkExperimental) IsExperimental

func (z RemarkExperimental) IsExperimental() bool

type RemarkIrreversible

type RemarkIrreversible struct {
}

func (RemarkIrreversible) IsIrreversible

func (z RemarkIrreversible) IsIrreversible() bool

type RemarkRecipeConsole

type RemarkRecipeConsole interface {
	// True if the recipe is console mode only.
	IsConsole() bool
}

type RemarkRecipeExperimental

type RemarkRecipeExperimental interface {
	// True if the recipe is in experimental phase.
	IsExperimental() bool
}

type RemarkRecipeIrreversible

type RemarkRecipeIrreversible interface {
	// True if the operation is irreversible.
	IsIrreversible() bool
}

type RemarkRecipeSecret

type RemarkRecipeSecret interface {
	// True if the recipe is not for general usage.
	IsSecret() bool
}

type RemarkRecipeTransient

type RemarkRecipeTransient interface {
	// True if the operation is transient. Logs will not be managed as like regular commands.
	IsTransient() bool
}

type RemarkSecret

type RemarkSecret struct {
}

func (RemarkSecret) IsSecret

func (z RemarkSecret) IsSecret() bool

type RemarkTransient

type RemarkTransient struct {
}

func (RemarkTransient) IsTransient

func (z RemarkTransient) IsTransient() bool

type Repository

type Repository interface {
	// Returns feeds that requested by the recipe
	Feeds() map[string]fd_file.RowFeed

	// Returns feed specifications that requested by the recipe
	FeedSpecs() map[string]fd_file.Spec

	// Returns reports that will created by the recipe
	Reports() map[string]rp_model.Report

	// Returns reports that will created by the recipe
	ReportSpecs() map[string]rp_model.Spec

	// Returns grid data input spec
	GridDataInputSpecs() map[string]da_griddata.GridDataInputSpec

	// Returns grid data output spec
	GridDataOutputSpecs() map[string]da_griddata.GridDataOutputSpec

	// Returns text input spec
	TextInputSpecs() map[string]da_text.TextInputSpec

	// Returns text input spec
	JsonInputSpecs() map[string]da_json.JsonInputSpec

	// Messages used by the recipe
	Messages() []app_msg.Message

	// List of fields
	FieldNames() []string

	// Text representation of the field value
	FieldValueText(name string) string

	// Field value
	FieldValue(name string) Value

	// Returns connections that requested by the recipe
	Conns() map[string]api_conn.Connection

	// Apply values in the repository to the
	Apply() Recipe

	// Apply custom values to the repository
	ApplyCustom()

	// Serialize
	Capture(ctl app_control.Control) (v interface{}, err error)

	// Deserialize & spin up
	Restore(j es_json.Json, ctl app_control.Control) error

	// Prepare values for run recipe
	SpinUp(ctl app_control.Control) (Recipe, error)

	// Spin down value
	SpinDown(ctl app_control.Control) error

	// Apply flag set
	ApplyFlags(f *flag.FlagSet, ui app_ui.UI)

	// Description of the field
	FieldDesc(name string) app_msg.Message

	// Custom description for default value
	FieldCustomDefault(name string) app_msg.MessageOptional

	// Serialize values for debug
	Debug() map[string]interface{}
}

type Spec

type Spec interface {
	SpecValue

	// Recipe name
	Name() string

	// Recipe title
	Title() app_msg.Message

	// Recipe description
	Desc() app_msg.MessageOptional

	// Recipe remarks
	Remarks() app_msg.MessageOptional

	// Path signature of the recipe
	Path() (path []string, name string)

	// Id of the recipe spec. Id format is path + name of Path() connected with `-` (dash).
	SpecId() string

	// Command name and link to the document
	CliNameRef(media dc_index.MediaType, lg lang.Lang, relPath string) app_msg.Message

	// Recipe path on cli
	CliPath() string

	// Recipe argument on cli
	CliArgs() app_msg.MessageOptional

	// Notes for the recipe on cli
	CliNote() app_msg.MessageOptional

	// Spec of reports generated by this recipe
	Reports() []rp_model.Spec

	// Spec of feeds
	Feeds() map[string]fd_file.Spec

	// Spec of grid data input
	GridDataInput() map[string]da_griddata.GridDataInputSpec

	// Spec of grid data output
	GridDataOutput() map[string]da_griddata.GridDataOutputSpec

	// Spec of text input
	TextInput() map[string]da_text.TextInputSpec

	// Spec of json input
	JsonInput() map[string]da_json.JsonInputSpec

	// Messages used by this recipe
	Messages() []app_msg.Message

	// Returns a list of services used by this recipe
	Services() []string

	// True if this recipe use connection to the Dropbox Personal account
	ConnUsePersonal() bool

	// True if this recipe use connection to the Dropbox Business account
	ConnUseBusiness() bool

	// Returns array of scope of connections to Dropbox account(s)
	ConnScopes() []string

	// Field name and scope label map
	ConnScopeMap() map[string]string

	// Serialize
	Capture(ctl app_control.Control) (v interface{}, err error)

	// Deserialize & spin up
	Restore(j es_json.Json, ctl app_control.Control) (rcp Recipe, err error)

	// Apply values to the new recipe instance
	SpinUp(ctl app_control.Control, custom func(r Recipe)) (rcp Recipe, err error)

	// Serialize values
	Debug() map[string]interface{}

	// SpinDown
	SpinDown(ctl app_control.Control) error

	// True if the recipe is not for general usage.
	IsSecret() bool

	// True if the recipe is not designed for non-console UI.
	IsConsole() bool

	// True if the recipe is in experimental phase.
	IsExperimental() bool

	// True if the operation is irreversible.
	IsIrreversible() bool

	// True if the operation is transient.
	IsTransient() bool

	// Print usage
	PrintUsage(ui app_ui.UI)

	// Create new spec
	New() Spec

	// Specification document
	Doc(ui app_ui.UI) *dc_recipe.Recipe

	// Error handlers for the recipe.
	ErrorHandlers() []rc_error_handler.ErrorHandler
}

type SpecValue

type SpecValue interface {
	// Array of value names
	ValueNames() []string

	// Value description for the name
	ValueDesc(name string) app_msg.Message

	// Value default for the name
	ValueDefault(name string) interface{}

	// Value for the name
	Value(name string) Value

	// Customized value default for the name
	ValueCustomDefault(name string) app_msg.MessageOptional

	// Configure CLI flags
	SetFlags(f *flag.FlagSet, ui app_ui.UI)
}

type Value

type Value interface {
	// Returns forked instance when the type is acceptable
	// Otherwise returns nil
	Accept(recipe interface{}, t reflect.Type, v0 interface{}, name string) Value

	// Return value reference of the instance
	Bind() interface{}

	// Initialize instance, and returns the instance to set
	Init() (v interface{})

	// Apply preset value
	ApplyPreset(v0 interface{})

	// Apply internal state (bind'ed value) to the instance.
	Apply() (v interface{})

	// Debug information
	Debug() interface{}

	// Serialize value
	Capture(ctl app_control.Control) (v interface{}, err error)

	// Deserialize value
	Restore(v es_json.Json, ctl app_control.Control) error

	// Spin up for run
	SpinUp(ctl app_control.Control) error

	// Spin down after run
	SpinDown(ctl app_control.Control) error

	// Value spec
	Spec() (typeName string, typeAttr interface{})
}

type ValueConn

type ValueConn interface {
	Value

	// True when the value is type of connection, and return the instance of the connection
	Conn() (conn api_conn.Connection, valid bool)
}

type ValueConns

type ValueConns interface {
	Value

	// True when the value is type of connection, and return the instance of the connection
	Conns() map[string]api_conn.Connection
}

type ValueCustomValueText

type ValueCustomValueText interface {
	Value

	ValueText() string
}

type ValueErrorHandler

type ValueErrorHandler interface {
	Value

	ErrorHandler() rc_error_handler.ErrorHandler
}

type ValueFeed

type ValueFeed interface {
	Value

	// True when the value is type of feed, and returns the instance of the feed
	Feed() (feed fd_file.RowFeed, valid bool)
}

type ValueGridDataInput

type ValueGridDataInput interface {
	Value

	// True when the value is type of grid data input
	GridDataInput() (gd da_griddata.GridDataInput, valid bool)
}

type ValueGridDataOutput

type ValueGridDataOutput interface {
	Value

	// True when the value is type of grid data output
	GridDataOutput() (gd da_griddata.GridDataOutput, valid bool)
}

type ValueJsonInput

type ValueJsonInput interface {
	Value

	// True when the value is type of text input
	JsonInput() (js da_json.JsonInput, valid bool)
}

type ValueMessage

type ValueMessage interface {
	Value

	// True when the value is type of message, and return the instance eof the conection
	Message() (msg app_msg.Message, valid bool)
}

type ValueMessages

type ValueMessages interface {
	Value

	// True when the value is type of message, and return the instance eof the conection
	Messages() (msg []app_msg.Message, valid bool)
}

type ValueReport

type ValueReport interface {
	Value

	// True when the value is type of report, and returns the instance of the report
	Report() (report rp_model.Report, valid bool)
}

type ValueReports

type ValueReports interface {
	Value

	// Returns reports that used by this value
	Reports() map[string]rp_model.Report
}

type ValueTextInput

type ValueTextInput interface {
	Value

	// True when the value is type of text input
	TextInput() (tx da_text.TextInput, valid bool)
}

Jump to

Keyboard shortcuts

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