binding

package
v2.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: MIT Imports: 18 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{}, obfuscate bool, enumsToBind []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) AddEnumToGenerateTS

func (b *Bindings) AddEnumToGenerateTS(e interface{})

func (*Bindings) AddStructToGenerateTS

func (b *Bindings) AddStructToGenerateTS(packageName string, structName string, s interface{})

func (*Bindings) DB

func (b *Bindings) DB() *DB

func (*Bindings) GenerateGoBindings

func (b *Bindings) GenerateGoBindings(baseDir string) error

func (*Bindings) GenerateModels

func (b *Bindings) GenerateModels() ([]byte, error)

func (*Bindings) SetOutputType

func (b *Bindings) SetOutputType(outputType string) *Bindings

func (*Bindings) SetTsPrefix

func (b *Bindings) SetTsPrefix(prefix string) *Bindings

func (*Bindings) SetTsSuffix

func (b *Bindings) SetTsSuffix(postfix string) *Bindings

func (*Bindings) ToJSON

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

func (*Bindings) WriteModels

func (b *Bindings) WriteModels(modelsDir 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) GetObfuscatedMethod

func (d *DB) GetObfuscatedMethod(id int) *BoundMethod

GetObfuscatedMethod returns the method for the given ID

func (*DB) ToJSON

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

ToJSON converts the method map to JSON

func (*DB) UpdateObfuscatedCallMap

func (d *DB) UpdateObfuscatedCallMap() map[string]int

UpdateObfuscatedCallMap sets up the secure call mappings

type ObfuscatedMethod

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

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