api

package
v0.0.0-...-6e6de49 Latest Latest
Warning

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

Go to latest
Published: May 31, 2021 License: Apache-2.0 Imports: 1 Imported by: 3

Documentation

Index

Constants

View Source
const HeadersModelKey = "_abstracte_api_headersmodel_key"
View Source
const InputModelKey = "_abstracte_api_inputmodel_key"
View Source
const InputParamsKey = "_abstracte_api_inputparams_key"
View Source
const LogIdx = 0x0
View Source
const LogKey = "_abstracte_api_config_log_key"
View Source
const QueryParamsKey = "_abstracte_api_queryparams_key"
View Source
const RuntimeKey = "_abstracte_api_runtime_key"
View Source
const ServiceResultKey string = "_abstracte_serviceresult_key"
View Source
const TenantIdx = 0x1
View Source
const TenantKey = "_abstracte_api_config_tenant_key"
View Source
const TxIdx = 0x1
View Source
const TxKey = "_abstracte_api_config_tx_key"

Variables

This section is empty.

Functions

This section is empty.

Types

type ApiError

type ApiError int
const (
	ApiErrorNoError              ApiError = 0x0
	ApiErrorEntityDoesNotExists  ApiError = 0x1
	ApiErrorUnexpected           ApiError = 0x2
	ApiErrorEntityAlreadyExists  ApiError = 0x3
	ApiErrorUnknownItemRequested ApiError = 0x4
	ApiErrorMissingRequiredItem  ApiError = 0x5
	ApiErrorAuthFailed           ApiError = 0x6
)

type C

type C struct {
	Handler interface{}
}

type Config

type Config interface {
	Valid() bool
}

type ConfigBuilder

type ConfigBuilder interface {
	Log(ConfigLog) ConfigBuilder
	CustomLog(C) ConfigBuilder
	Tenant(ConfigTenant) ConfigBuilder
	CustomTenant(C) ConfigBuilder
	Tx(ConfigTx) ConfigBuilder
	CustomTx(C) ConfigBuilder
	Headers(interface{}) ConfigBuilder
	CustomHeaders(C) ConfigBuilder
	InputModel(interface{}) ConfigBuilder
	CustomInputModel(C) ConfigBuilder
	InputParams(name []string) ConfigBuilder
	CustomInputParam(C) ConfigBuilder
	QueryParams(interface{}) ConfigBuilder
	CustomQueryParams(C) ConfigBuilder
	CustomBeforeRun(C) ConfigBuilder
	CustomAfterRun(C) ConfigBuilder
	Build() Config
}

type ConfigLog

type ConfigLog uint
const (
	ConfigLogRandom      ConfigLog = 0x0
	ConfigLogFromHeaders ConfigLog = 0x1
)

type ConfigTenant

type ConfigTenant uint
const (
	ConfigTenantNo          ConfigTenant = 0x0
	ConfigTenantFromHeaders ConfigTenant = 0x1
)

type ConfigTx

type ConfigTx uint
const (
	ConfigTxManaged   ConfigTx = 0x1
	ConfigTxUnmanaged ConfigTx = 0x2
)

type ErrorModel

type ErrorModel struct {
	// Service error code.
	// required: true
	Code ApiError `json:"code"`

	// Error hint message
	Msg string `json:"msg"`

	// Detailed error hint message
	DevMsg string `json:"devMsg"`

	// Request correlation id
	CorrId string `json:"corrId"`
}

swagger:model ErrorModel

type Http

type Http interface {
	AddRoute(method string, path string, config Config, service Service) error
	Listen(port int, address string) error
}

type Model

type Model struct {
	// The error response of the API
	//
	// required: true
	Error ErrorModel `json:"err"`

	// Business response of the service. Skipped if error occurs
	Data interface{} `json:"data,omitempty"`
}

swagger:model Model

type Service

type ServiceInput

type ServiceInput interface {
	RawCtx() interface{}
	Model() interface{}
	InputParams() map[string]string
	QueryParams() interface{}
	Headers() interface{}
}

type ServiceOutput

type ServiceOutput interface {
	Status() ApiError
	Err() error
	ErrMessage() string
	ResponseModel() interface{}
}

Directories

Path Synopsis
gin module
std module

Jump to

Keyboard shortcuts

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