fixtures

package
v3.0.28 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2022 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Build

func Build(opts Option)

Build the basic option for defining the generation.

func Swipe

func Swipe()

func SwipeConfig

func SwipeConfig()

func Test

func Test() error

Types

type Config

type Config struct {
	Name string
}

type ConfigEnvOption

type ConfigEnvOption string

A ConfigEnvOption is an option env config.

func ConfigEnvDocEnable

func ConfigEnvDocEnable() ConfigEnvOption

ConfigEnvDocEnable enable markdown doc generate.

func ConfigEnvDocOutput

func ConfigEnvDocOutput(output string) ConfigEnvOption

ConfigEnvDocOutput output path markdown doc generate.

func ConfigEnvFuncName

func ConfigEnvFuncName(name string) ConfigEnvOption

type MethodOption

type MethodOption string

A MethodOption is an option method.

func ClientDecodeResponseFunc

func ClientDecodeResponseFunc(fn interface{}) MethodOption

ClientDecodeResponseFunc sets a function to extract the user's domain response object from the response object.

func ClientEncodeRequestFunc

func ClientEncodeRequestFunc(fn interface{}) MethodOption

ClientEncodeRequestFunc sets the function to encode the passed request object into an object.

func Exclude

func Exclude(enable bool) MethodOption

func Instrumenting

func Instrumenting(enable bool) MethodOption

InstrumentingEnable a option enabled/disable instrumenting (collect metrics) middleware.

func InstrumentingDisable

func InstrumentingDisable() MethodOption

InstrumentingDisable a option disable instrumenting (collect metrics) middleware.

func Logging

func Logging(enable bool) MethodOption

Logging a option enabled/disable logging middleware.

func LoggingContext

func LoggingContext(key interface{}, name string) MethodOption

func LoggingParams

func LoggingParams(includes []string, excludes []string) MethodOption

func RESTHeaderVars

func RESTHeaderVars(value ...string) MethodOption

HeaderVars sets the key/value array to get method values from headers, where the key is the name of the method parameter, and the value is the name of the header.

func RESTMethod

func RESTMethod(value string) MethodOption

RESTMethod sets http method, default is GET.

func RESTPath

func RESTPath(value string) MethodOption

Path sets http path, default is lowecase method name with the prefix "/", for example: the Get method will look like " /get".

func RESTQueryVars

func RESTQueryVars(value ...string) MethodOption

QueryVars sets the key/value array to get method values from query args, where the key is the name of the method parameter, and the value is the name of the query args.

func RESTWrapResponse

func RESTWrapResponse(value string) MethodOption

WrapResponse wrap the response from the server to an object, for example if you want to return as:

{data: { you response data }}

need to add option:

...code here...
WrapResponse("data")
... code here ...

func ServerDecodeRequestFunc

func ServerDecodeRequestFunc(fn interface{}) MethodOption

ServerDecodeRequestFunc sets a function to extract the user's domain request object from the request object.

func ServerEncodeResponseFunc

func ServerEncodeResponseFunc(fn interface{}) MethodOption

ServerEncodeResponseFunc sets the encoding function of the passed response object to the response writer.

type OpenapiServerOption

type OpenapiServerOption string

A OpenapiServerOption is an openapi concrete server option.

type OpenapiServersOption

type OpenapiServersOption string

A OpenapiServersOption is an openapi servers option.

type Option

type Option string

A Option is an option for a Swipe.

func ConfigEnv

func ConfigEnv(optionsStruct interface{}, opts ...ConfigEnvOption) Option

ConfigEnv option for config generation.

To generate a configuration loader, you can use the swipe.ConfigEnv option. The optionsStruct parameter is a pointer to the configuration structure.

The option can work with all primitives, including datetime, and an array of primitives.

The option supports nested structures.

To use the default value, just specify it as a value in the structure.

Default func name is `LoadConfig`.

You can use structure tags to control generation:

env  - name of environment var, options: `required`.

flag - name of flag, enable as the console flag.

desc - description for String function.

func Service

func Service(opts ...ServiceOption) Option

Service a option that defines the generation of transport, metrics, tracing, and logging for gokit. Given iface is nil pointer interface, for example:

(*pkg.Iface)(nil)

type ServiceA

type ServiceA interface {
	// TestMethod dvsdvsdvsdvsdv
	// @name sdvsvsdv
	TestMethod(name string) error
	// TestMethod2 sdvsdsdv
	// @name sdvsvsdv
	TestMethod2(name string) error
}

type ServiceOption

type ServiceOption string

A ServiceOption is an option service.

func AppName

func AppName(value string) ServiceOption

func ClientsEnable

func ClientsEnable(langs []string) ServiceOption

ClientsEnable enable generate Golang, JavaScript client.

func DefaultErrorEncoder

func DefaultErrorEncoder(fn interface{}) ServiceOption

DefaultErrorEncoder is responsible for encoding the server error.

func HTTPFast

func HTTPFast() ServiceOption

HTTPFast enable generate fast http server.

func HTTPServer

func HTTPServer() ServiceOption

HTTPServer enable generate http server.

func Interface

func Interface(iface interface{}, ns string) ServiceOption

@type:"repeat"

func JSONRPCDocEnable

func JSONRPCDocEnable() ServiceOption

JSONRPCDocEnable enable for generate markdown JSON RPC doc.

func JSONRPCDocOutput

func JSONRPCDocOutput(output string) ServiceOption

JSONRPCDocOutput change output dir for generate markdown JSON RPC doc.

func JSONRPCEnable

func JSONRPCEnable() ServiceOption

JSONRPCEnable enabled use JSON RPC instead of REST.

func JSONRPCPath

func JSONRPCPath(value string) ServiceOption

JSONRPCPath sets the end point for transport.

func MethodDefaultOptions

func MethodDefaultOptions(opts ...MethodOption) ServiceOption

MethodDefaultOptions option for defining for all methods default settings.

func MethodOptions

func MethodOptions(signature interface{}, opts ...MethodOption) ServiceOption

MethodOptions option for defining method settings. Given signature is interface method, for example: pkg.Interface.Create @type:"repeat"

func OpenapiContact

func OpenapiContact(name, email, url string) ServiceOption

OpenapiContact sets openapi contact.

func OpenapiEnable

func OpenapiEnable() ServiceOption

OpenapiEnable enabled generate openapi documentation.

func OpenapiInfo

func OpenapiInfo(title, description, version string) ServiceOption

OpenapiInfo sets info.

func OpenapiLicence

func OpenapiLicence(name, url string) ServiceOption

OpenapiLicence sets openapi licence.

func OpenapiOutput

func OpenapiOutput(value string) ServiceOption

OpenapiOutput sets output directory, path relative to the file, default is "./".

func OpenapiServer

func OpenapiServer(description, url string) ServiceOption

OpenapiServer sets openapi server. @type:"repeat"

func OpenapiTags

func OpenapiTags(methods []interface{}, tags []string) ServiceOption

OpenapiTags sets docs tags for method.

func ReadmeEnable

func ReadmeEnable() ServiceOption

ReadmeEnable enable for generate readme markdown for service.

func ReadmeOutput

func ReadmeOutput(value string) ServiceOption

func ReadmeTemplatePath

func ReadmeTemplatePath(value string) ServiceOption

Jump to

Keyboard shortcuts

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