generator

package
v3.1.8 Latest Latest
Warning

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

Go to latest
Published: Jan 30, 2024 License: MIT Imports: 16 Imported by: 1

README

bindgen (aka bindings generator)

bindgen is a tool that automatically generated bindings for native go packages with 'goja'

Native Go packages are available here

Generated Output is available here

bindgen generates 3 different types of outputs

  • go => this directory contains corresponding goja bindings (actual bindings code) ex: kerberos.go
  • js => this is more of a javascript representation of all exposed functions and types etc in javascript ex: kerberos.js and does not server any functional purpose other than reference
  • markdown => autogenerated markdown documentation for each library / package ex: kerberos.md

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetLibraryModules

func GetLibraryModules(directory string) ([]string, error)

GetLibraryModules takes a directory and returns subdirectories as modules

Types

type PackageFuncExtra

type PackageFuncExtra struct {
	Items map[string]PackageFunctionExtra
	Doc   string
}

PackageFuncExtra contains extra information about a function

type PackageFunctionExtra

type PackageFunctionExtra struct {
	Args    []string
	Name    string
	Returns []string
	Doc     string
}

PackageFunctionExtra contains extra information about a function

type PackageTypeExtra

type PackageTypeExtra struct {
	Fields map[string]string
}

PackageTypeExtra contains extra information about a type

type TemplateData

type TemplateData struct {
	PackageName             string
	PackagePath             string
	PackageFuncs            map[string]string
	PackageInterfaces       map[string]string
	PackageFuncsExtraNoType map[string]PackageFunctionExtra
	PackageFuncsExtra       map[string]PackageFuncExtra
	PackageVars             map[string]string
	PackageVarsValues       map[string]string
	PackageTypes            map[string]string
	PackageTypesExtra       map[string]PackageTypeExtra

	// NativeScripts contains the list of native scripts
	// that should be included in the package.
	NativeScripts []string
	// contains filtered or unexported fields
}

TemplateData contains the parameters for the JS code generator

func CreateTemplateData

func CreateTemplateData(directory string, packagePrefix string) (*TemplateData, error)

CreateTemplateData creates a TemplateData structure from a directory of go source code.

func (*TemplateData) InitNativeScripts

func (d *TemplateData) InitNativeScripts()

InitNativeScripts initializes the native scripts array with all the exported functions from the runtime

func (*TemplateData) WriteGoTemplate

func (d *TemplateData) WriteGoTemplate(outputDirectory string, pkgName string) error

WriteGoTemplate writes the go template to the output file

func (*TemplateData) WriteJSTemplate

func (d *TemplateData) WriteJSTemplate(outputDirectory string, pkgName string) error

WriteJSTemplate writes the js template to the output file

func (*TemplateData) WriteMarkdownIndexTemplate

func (d *TemplateData) WriteMarkdownIndexTemplate(outputDirectory string) error

WriteMarkdownIndexTemplate writes the markdown documentation to the output file

func (*TemplateData) WriteMarkdownLibraryDocumentation

func (d *TemplateData) WriteMarkdownLibraryDocumentation(outputDirectory string, pkgName string) error

WriteMarkdownLibraryDocumentation writes the markdown documentation for a js library to the output file

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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