binding

package
v2.0.0-alpha.73 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bindings

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

func NewBindings

func NewBindings(logger *logger.Logger, structPointersToBind []interface{}, exemptions []interface{}) *Bindings

NewBindings returns a new Bindings object

func (*Bindings) Add

func (b *Bindings) Add(structPtr interface{}) error

Add the given struct methods to the Bindings

func (*Bindings) DB

func (b *Bindings) DB() *DB

func (*Bindings) GenerateBackendJS

func (b *Bindings) GenerateBackendJS()

func (*Bindings) ToJSON

func (b *Bindings) ToJSON() (string, error)

type BoundMethod

type BoundMethod struct {
	Name     string        `json:"name"`
	Inputs   []*Parameter  `json:"inputs,omitempty"`
	Outputs  []*Parameter  `json:"outputs,omitempty"`
	Comments string        `json:"comments,omitempty"`
	Method   reflect.Value `json:"-"`
}

BoundMethod defines all the data related to a Go method that is bound to the Wails application

func (*BoundMethod) Call

func (b *BoundMethod) Call(args []interface{}) (interface{}, error)

Call will attempt to call this bound method with the given args

func (*BoundMethod) InputCount

func (b *BoundMethod) InputCount() int

InputCount returns the number of inputs this bound method has

func (*BoundMethod) OutputCount

func (b *BoundMethod) OutputCount() int

OutputCount returns the number of outputs this bound method has

func (*BoundMethod) ParseArgs

func (b *BoundMethod) ParseArgs(args []json.RawMessage) ([]interface{}, error)

ParseArgs method converts the input json into the types expected by the method

type DB

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

DB is our database of method bindings

func (*DB) AddMethod

func (d *DB) AddMethod(packageName string, structName string, methodName string, methodDefinition *BoundMethod)

AddMethod adds the given method definition to the db using the given qualified path: packageName.structName.methodName

func (*DB) GetMethod

func (d *DB) GetMethod(qualifiedMethodName string) *BoundMethod

GetMethod returns the method for the given qualified method name qualifiedMethodName is "packagename.structname.methodname"

func (*DB) GetMethodFromStore

func (d *DB) GetMethodFromStore(packageName string, structName string, methodName string) *BoundMethod

GetMethodFromStore returns the method for the given package/struct/method names nil is returned if any one of those does not exist

func (*DB) ToJSON

func (d *DB) ToJSON() (string, error)

ToJSON converts the method map to JSON

type Parameter

type Parameter struct {
	Name     string `json:"name,omitempty"`
	TypeName string `json:"type"`
	// contains filtered or unexported fields
}

Parameter defines a Go method parameter

func (*Parameter) IsError

func (p *Parameter) IsError() bool

IsError returns true if the parameter type is an error

func (*Parameter) IsType

func (p *Parameter) IsType(typename string) bool

IsType returns true if the given

Jump to

Keyboard shortcuts

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