core

package
v0.0.0-...-dbcf505 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: Apache-2.0 Imports: 15 Imported by: 0

README

Renio core

The directory contains the core code for Renio's runtime agnostic.

It comes with a powerful and easy Go API for developers to embed Renio apps into their Go apps.

Documentation

Index

Constants

View Source
const (
	// FileSystem ops
	FSWrite     = 1
	FSRead      = 2
	FSExists    = 3
	FSDirExists = 4
	FSCwd       = 5
	FSStat      = 6
	FSRemove    = 7
	FSMkdir     = 9
	FSWalk      = 14
	// console ops
	Log = 10
	// env ops
	Env = 11
	// plugin ops
	Plugin = 15
	// fetch ops
	Fetch = 20
	// serve ops
	Serve = 25
)

Variables

This section is empty.

Functions

func ConsoleLog

func ConsoleLog(ctx *quickjs.Context, value []quickjs.Value) quickjs.Value

console.log bindings to quickjs engine

func EnvChecker

func EnvChecker(perms *options.Perms)

func FileSystemChecker

func FileSystemChecker(perms *options.Perms)

FileSystemChecker utility to check whether file system access is avaliable or not

func Marshal

func Marshal(jsonObj interface{}) ([]byte, error)

Marshal JSON data with default options

func NetChecker

func NetChecker(perms *options.Perms)

NetChecker utility to check whether net access is avaliable or not

func OpenPlugin

func OpenPlugin(path string, arg interface{}) interface{}

OpenPlugin open a dynamic lib and call the exported RenioPlugin function with the args provided by the plugin op Currently, not compatible with windows

func PrepareRuntimeContext

func PrepareRuntimeContext(cxt *quickjs.Context, jsruntime quickjs.Runtime, args []string, flags *options.Perms, mode string)

PrepareRuntimeContext prepare the runtime and context with Renio's internal ops injects `__send` and `__recv` global dispatch functions into runtime

func RenioRecvNameSpace

func RenioRecvNameSpace(renio *options.Renio) func(ctx *quickjs.Context, this quickjs.Value, args []quickjs.Value) quickjs.Value

RenioRecvNameSpace Native function corresponding to the JavaScript global `__recv` It is binded with `__recv` and accepts arguments including recv ID of the async function

func RenioSendNameSpace

func RenioSendNameSpace(renio *options.Renio) func(ctx *quickjs.Context, this quickjs.Value, args []quickjs.Value) quickjs.Value

RenioSendNameSpace Native function corresponding to the JavaScript global `__send` It is binded with `__send` and accepts arguments including op ID

func Run

func Run(opt options.Options)

Run create and dispatch a QuickJS runtime binded with Renio's OPs configurable using options

Types

type Formatter

type Formatter struct {
	KeyColor        *color.Color
	StringColor     *color.Color
	BoolColor       *color.Color
	NumberColor     *color.Color
	NullColor       *color.Color
	StringMaxLength int
	Indent          int
	DisabledColor   bool
	RawStrings      bool
}

func NewF

func NewF() *Formatter

func (*Formatter) Marshal

func (f *Formatter) Marshal(jsonObj interface{}) ([]byte, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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