execute

package
v0.4.42 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2023 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CommandResponse

type CommandResponse struct {
	Items []CommandResponseItem `json:"items"`
}

CommandResponse defiens command response

type CommandResponseItem

type CommandResponseItem struct {
	Type  string      `json:"type"` // e.g. recordset
	Value interface{} `json:"value"`
}

CommandResponseItem defines response item

type Executor

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

Executor executes DataTug commands

func NewExecutor

func NewExecutor(
	getDbByID func(envID, dbID string) (*models.EnvDb, error),
	getCatalogSummary func(server models.ServerReference, catalogID string) (*models.DbCatalogSummary, error),
) Executor

NewExecutor creates new executor

func (Executor) Execute

func (e Executor) Execute(request Request) (response Response, err error)

Execute executes DataTug commands

func (Executor) ExecuteSingle

func (e Executor) ExecuteSingle(command RequestCommand) (response Response, err error)

ExecuteSingle executes single DB command

type Request

type Request struct {
	ID       string           `json:"id"`
	Project  string           `json:"project"`
	Commands []RequestCommand `json:"commands"`
}

Request defines what needs to be executed

func (Request) Validate

func (v Request) Validate() error

Validate checks if request is valid

type RequestCommand

type RequestCommand struct {
	models.Credentials // holds username & password, if not provided trusted connection
	models.ServerReference
	Env        string             `json:"env"`
	DB         string             `json:"db"`
	Text       string             `json:"text"`
	Parameters []models.Parameter `json:"parameters"`
}

RequestCommand holds parameters for command to be executed

func (RequestCommand) Validate

func (v RequestCommand) Validate() error

Validate checks of command request is valid

type Response

type Response struct {
	Duration time.Duration      `json:"durationNanoseconds"`
	Commands []*CommandResponse `json:"commands"`
}

Response holds execute response

Jump to

Keyboard shortcuts

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