exttinygo

package
v1.202405300917.1 Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 2 Imported by: 0

README

exttinygo

Principles

  • Exchange buffer: 1MB of memory is pre-allocated for each instance of the extension
  • gc=leaking

Usage

package main

import (
	ext "github.com/voedger/voedger/pkg/exttinygo"
)

//export exampleExtension
func exampleExtension() {
	event := ext.GetValue(ext.KeyBuilder(ext.StorageEvent, ext.NullEntity))

	if event.AsString("qname") == "air.UpdateSubscription" {
		json := event.AsValue("arg")
		subscr := json.AsValue("subscription")
		customer := json.AsValue("customer")
		mail := ext.NewValue(ext.KeyBuilder(ext.StorageSendmail, ext.NullEntity))
		mail.PutString("from", "test@gmail.com")
		mail.PutString("to", customer.AsString("email"))
		mail.PutString("body", "Your subscription has been updated. New status: "+subscr.AsString("status"))
	}
}

Documentation

Index

Constants

View Source
const (
	StorageEvent          = "sys.Event"
	StorageSendMail       = "sys.SendMail"
	StorageRecord         = "sys.Record"
	StorageView           = "sys.View"
	StorageWLog           = "sys.WLog"
	StorageHttp           = "sys.Http"
	StorageAppSecret      = "sys.AppSecret"
	StorageRequestSubject = "sys.RequestSubject"
	StorageResult         = "sys.Result"
	StorageCommandContext = "sys.CommandContext"
	StorageQueryContext   = "sys.QueryContext"
	StorageResponse       = "sys.Response"

	NullEntity = ""
)

Variables

View Source
var KeyBuilder func(storage, entity string) (b TKeyBuilder) = keyBuilderImpl
View Source
var MustGetValue func(key TKeyBuilder) TValue = mustGetValueImpl

MustGetValue gets value. Panics when value is not exist

View Source
var NewValue func(key TKeyBuilder) TIntent = newValueImpl

NewValue creates intent for new value

View Source
var QueryValue func(key TKeyBuilder) (value TValue, exists bool) = queryValueImpl

QueryValue queries value. When not exists it returns exists=false and value=nil.

View Source
var ReadValues func(key TKeyBuilder, callback func(key TKey, value TValue)) = readValuesImpl

ReadValues reads using partial key and returns values in callback.

Important: key and value are not kept after callback!

View Source
var UpdateValue func(key TKeyBuilder, existingValue TValue) TIntent = updateValueImpl

UpdateValue creates intent to update a value

Functions

func Assert

func Assert(condition bool, msg string)

Types

type QName

type QName safe.QName

type TIntent

type TIntent safe.TIntent

func (TIntent) PutBool

func (i TIntent) PutBool(name string, value bool)

func (TIntent) PutBytes

func (i TIntent) PutBytes(name string, value []byte)

func (TIntent) PutFloat32

func (i TIntent) PutFloat32(name string, value float32)

func (TIntent) PutFloat64

func (i TIntent) PutFloat64(name string, value float64)

func (TIntent) PutInt32

func (i TIntent) PutInt32(name string, value int32)

func (TIntent) PutInt64

func (i TIntent) PutInt64(name string, value int64)

func (TIntent) PutQName

func (i TIntent) PutQName(name string, value QName)

func (TIntent) PutString

func (i TIntent) PutString(name string, value string)

type TKey

type TKey safe.TKey

func (TKey) AsBool

func (k TKey) AsBool(name string) bool

func (TKey) AsBytes

func (k TKey) AsBytes(name string) []byte

func (TKey) AsFloat32

func (k TKey) AsFloat32(name string) float32

func (TKey) AsFloat64

func (k TKey) AsFloat64(name string) float64

func (TKey) AsInt32

func (k TKey) AsInt32(name string) int32

func (TKey) AsInt64

func (k TKey) AsInt64(name string) int64

func (TKey) AsQName

func (k TKey) AsQName(name string) QName

func (TKey) AsString

func (k TKey) AsString(name string) string

type TKeyBuilder

type TKeyBuilder safe.TKeyBuilder

func (TKeyBuilder) PutBool

func (kb TKeyBuilder) PutBool(name string, value bool)

func (TKeyBuilder) PutBytes

func (kb TKeyBuilder) PutBytes(name string, value []byte)

func (TKeyBuilder) PutFloat32

func (kb TKeyBuilder) PutFloat32(name string, value float32)

func (TKeyBuilder) PutFloat64

func (kb TKeyBuilder) PutFloat64(name string, value float64)

func (TKeyBuilder) PutInt32

func (kb TKeyBuilder) PutInt32(name string, value int32)

func (TKeyBuilder) PutInt64

func (kb TKeyBuilder) PutInt64(name string, value int64)

func (TKeyBuilder) PutQName

func (kb TKeyBuilder) PutQName(name string, value QName)

func (TKeyBuilder) PutString

func (kb TKeyBuilder) PutString(name string, value string)

type TValue

type TValue safe.TValue

func (TValue) AsBool

func (v TValue) AsBool(name string) bool

func (TValue) AsBytes

func (v TValue) AsBytes(name string) []byte

func (TValue) AsFloat32

func (v TValue) AsFloat32(name string) float32

func (TValue) AsFloat64

func (v TValue) AsFloat64(name string) float64

func (TValue) AsInt32

func (v TValue) AsInt32(name string) int32

func (TValue) AsInt64

func (v TValue) AsInt64(name string) int64

func (TValue) AsQName

func (v TValue) AsQName(name string) QName

func (TValue) AsString

func (v TValue) AsString(name string) string

func (TValue) AsValue

func (v TValue) AsValue(name string) TValue

func (TValue) GetAsBool

func (v TValue) GetAsBool(index int) bool

func (TValue) GetAsBytes

func (v TValue) GetAsBytes(index int) []byte

func (TValue) GetAsFloat32

func (v TValue) GetAsFloat32(index int) float32

func (TValue) GetAsFloat64

func (v TValue) GetAsFloat64(index int) float64

func (TValue) GetAsInt32

func (v TValue) GetAsInt32(index int) int32

func (TValue) GetAsInt64

func (v TValue) GetAsInt64(index int) int64

func (TValue) GetAsQName

func (v TValue) GetAsQName(index int) QName

func (TValue) GetAsString

func (v TValue) GetAsString(index int) string

func (TValue) GetAsValue

func (v TValue) GetAsValue(index int) TValue

func (TValue) Len

func (v TValue) Len() int

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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