Help us shape the future of Go! Take the 2026 Go Developer Survey

swails

package
v0.48.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2024 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExecuteHandlingError

func ExecuteHandlingError(ctx context.Context, cmd *WailsSnake)

func NewCommandResolver

func NewCommandResolver(s SWails) snake.TypedResolver[SWails]

func ReflectValueToEnum

func ReflectValueToEnum(v reflect.Type) enum

Types

type ContextResolver

type ContextResolver struct {
}

func (*ContextResolver) Run

func (me *ContextResolver) Run() (context.Context, error)

type OutputHandler

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

func NewOutputHandler

func NewOutputHandler(cmd io.Writer) *OutputHandler

func (*OutputHandler) HandleFileOutput

func (me *OutputHandler) HandleFileOutput(ctx context.Context, _ snake.Chan, out *snake.FileOutput) error

HandleFileOutput implements sbind.OutputHandler.

func (*OutputHandler) HandleJSONOutput

func (me *OutputHandler) HandleJSONOutput(ctx context.Context, _ snake.Chan, out *snake.JSONOutput) error

func (*OutputHandler) HandleLongRunningOutput

func (*OutputHandler) HandleLongRunningOutput(ctx context.Context, _ snake.Chan, out *snake.LongRunningOutput) error

HandleLongRunningOutput implements sbind.OutputHandler.

func (*OutputHandler) HandleNilOutput

func (me *OutputHandler) HandleNilOutput(ctx context.Context, _ snake.Chan, out *snake.NilOutput) error

HandleNilOutput implements sbind.OutputHandler.

func (*OutputHandler) HandleRawTextOutput

func (me *OutputHandler) HandleRawTextOutput(ctx context.Context, _ snake.Chan, out *snake.RawTextOutput) error

HandleRawTextOutput implements sbind.OutputHandler.

func (*OutputHandler) HandleTableOutput

func (me *OutputHandler) HandleTableOutput(ctx context.Context, _ snake.Chan, out *snake.TableOutput) error

HandleTableOutput implements sbind.OutputHandler.

func (*OutputHandler) Stderr added in v0.31.0

func (me *OutputHandler) Stderr() io.Writer

func (*OutputHandler) Stdin added in v0.31.0

func (me *OutputHandler) Stdin() io.Reader

func (*OutputHandler) Stdout added in v0.31.0

func (me *OutputHandler) Stdout() io.Writer

type SWails

type SWails interface {
	Name() string
	Description() string
	Image() string
	Emoji() string
}

type WailsCommand

type WailsCommand struct {
	Name        string `json:"name"`
	Description string `json:"description"`
	Image       string `json:"image"`
	Emoji       string `json:"emoji"`
}

type WailsEmitEvent added in v0.40.0

type WailsEmitEvent struct {
	Name string `json:"name"`
	Data any    `json:"data"`
}

type WailsEmitter

type WailsEmitter func(ctx context.Context, eventName string, optionalData ...interface{})

WailsEmitter is the function type as provided

type WailsEvent

type WailsEvent struct {
	Name string
	Func func(args ...any)
}

type WailsHTMLResponse

type WailsHTMLResponse struct {
	Default     string     `json:"default"`
	Text        string     `json:"text"`
	JSON        any        `json:"json"`
	Table       [][]string `json:"table"`
	TableStyles [][]string `json:"table_styles"`
}

type WailsInput

type WailsInput struct {
	Name    string          `json:"name"`
	Type    snake.InputType `json:"type"`
	Value   any             `json:"value"`
	Shared  bool            `json:"shared"`
	Command string          `json:"command"`
}

type WailsSnake

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

func NewWailsSnake

func NewWailsSnake(ctx context.Context, emitter WailsEmitter) *WailsSnake

func (*WailsSnake) Commands

func (me *WailsSnake) Commands() ([]*WailsCommand, error)

func (*WailsSnake) CurrentInput

func (me *WailsSnake) CurrentInput(cmd SWails, input snake.Input) (*WailsInput, error)

func (*WailsSnake) Decorate

func (me *WailsSnake) Decorate(ctx context.Context, self snake.TypedResolver[SWails], snk snake.Snake, inputs []snake.Input, mw []snake.Middleware) error

func (*WailsSnake) Events

func (me *WailsSnake) Events() []*WailsEvent

func (*WailsSnake) Inputs

func (me *WailsSnake) Inputs() ([]*WailsInput, error)

func (*WailsSnake) InputsFor

func (me *WailsSnake) InputsFor(name *WailsCommand) ([]*WailsInput, error)

func (*WailsSnake) ManagedResolvers

func (me *WailsSnake) ManagedResolvers(_ context.Context) []snake.UntypedResolver

func (*WailsSnake) OnSnakeInit

func (me *WailsSnake) OnSnakeInit(ctx context.Context, snk snake.Snake) error

func (*WailsSnake) OptionsForEnum

func (me *WailsSnake) OptionsForEnum(input *WailsInput) ([]string, error)

func (*WailsSnake) ProvideContextResolver

func (me *WailsSnake) ProvideContextResolver() snake.UntypedResolver

func (*WailsSnake) ResolveEnum

func (me *WailsSnake) ResolveEnum(typ string, opts []string) (string, error)

func (*WailsSnake) Run

func (me *WailsSnake) Run(name *WailsCommand) (*WailsHTMLResponse, error)

the handler is designed to be a wails binding that will automatically inject snake bindings

func (*WailsSnake) RunWithWriter added in v0.40.0

func (me *WailsSnake) RunWithWriter(id string, name *WailsCommand) (*WailsWriter, error)

func (*WailsSnake) SetLifecycleContext added in v0.40.0

func (me *WailsSnake) SetLifecycleContext(ctx context.Context)

func (*WailsSnake) UpdateInput

func (me *WailsSnake) UpdateInput(input *WailsInput) (*WailsInput, error)

type WailsWriter added in v0.40.0

type WailsWriter struct {
	Name string `json:"name"`
	// contains filtered or unexported fields
}

WailsWriter implements the io.Writer interface and sends data to a WailsEmitter.

func (*WailsWriter) Write added in v0.40.0

func (w *WailsWriter) Write(p []byte) (n int, err error)

Write implements the io.Writer interface for WailsWriter.

Jump to

Keyboard shortcuts

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