mxt

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: Apache-2.0 Imports: 9 Imported by: 0

README

mxt

Endpoint data transformation shim using Tengo for scripting.

Demo

Start fake API server:

docker-compose up

Run mxt:

go run ./cmd/mxt.go -config=./cfg/simple.yml

Get endpoint:

curl http://localhost:8080/get/twentyfour

Development

Test Release

goreleaser --skip-publish --rm-dist --skip-validate

Release

GITHUB_TOKEN=$GITHUB_TOKEN goreleaser --rm-dist

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Endpoint

type Endpoint struct {
	Description string `yaml:"description"`
	Location    string `yaml:"location"`
	Transform   string `yaml:"transform"`
}

Endpoint

type EpConfig

type EpConfig struct {
	Endpoints  map[string]Endpoint  `yaml:"endpoints"`
	Transforms map[string]Transform `yaml:"transforms"`
}

EpConfig

func CfgFromFile

func CfgFromFile(file string) (*EpConfig, error)

CfgFromFile creates a configuration file from YAML

type Proxy

type Proxy struct {
	*ProxyCfg
}

Proxy

func NewProxy

func NewProxy(cfg *ProxyCfg) (*Proxy, error)

NewProxy

func (*Proxy) EpHandler

func (p *Proxy) EpHandler(c *gin.Context)

EpHandler is an Endpoint Handler accepting a gin context and returns plain text

type ProxyCfg

type ProxyCfg struct {
	EpConfig   *EpConfig
	Logger     *zap.Logger
	HttpClient *micro.Client
	// contains filtered or unexported fields
}

type Transform

type Transform struct {
	Description string `yaml:"description"`
	Script      string `yaml:"script"`
}

Transform

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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