apiBuilder

package module
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2020 License: MIT Imports: 10 Imported by: 0

README

apiBuilder

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddData

func AddData(ctx iris.Context)

新增数据

func DeleteData

func DeleteData(ctx iris.Context)

删除数据 /{id:uint64}

func EditData

func EditData(ctx iris.Context)

编辑数据 /{id:uint64}

func GetAllFunc

func GetAllFunc(ctx iris.Context)

获取所有 分页 页码用page标识

func GetSingle

func GetSingle(ctx iris.Context)

单个 /{id:uint64}

func IsNum

func IsNum(s string) bool

Types

type Api

type Api struct {
	Config     *Config
	ModelLists []modelInfo
}

func New

func New(c Config) *Api

func (*Api) Run

func (c *Api) Run()

type Config

type Config struct {
	App        *iris.Application
	StructList []interface{}
	Engine     *xorm.Engine
	Prefix     string // 访问前缀 例如:/api/v1
}

type DeleteProcess

type DeleteProcess interface {
	ApiDelete(ctx iris.Context)
}

type DisableMethodsProcess

type DisableMethodsProcess interface {
	ApiDisableMethods() []string
}

禁止方法生成 默认生成 get(all) get(single) post put delete

type GetAllPreMiddlewareProcess

type GetAllPreMiddlewareProcess interface {
	ApiGetAllPreMiddleware(ctx iris.Context)
}

方法单独的中间件

type GetAllProcess

type GetAllProcess interface {
	ApiGetAll(ctx iris.Context)
}

覆盖方法

type GetSinglePreMiddlewareProcess

type GetSinglePreMiddlewareProcess interface {
	ApiGetSinglePreMiddleware(ctx iris.Context)
}

type GetSingleProcess

type GetSingleProcess interface {
	ApiGetSingle(ctx iris.Context)
}

type GlobalPreMiddlewareProcess

type GlobalPreMiddlewareProcess interface {
	ApiGlobalPreMiddleware(ctx iris.Context)
}

全局访问中间件 优先级最高

type PostPreMiddlewareProcess

type PostPreMiddlewareProcess interface {
	ApiPostPreMiddleware(ctx iris.Context)
}

type PostProcess

type PostProcess interface {
	ApiPost(ctx iris.Context)
}

type PrivateAccessProcess

type PrivateAccessProcess interface {
	// 上下文获取私密条件内容的key
	ApiPrivateContextKey() string
	// 数据列名
	ApiPrivateTableColName() string
}

私密访问

type PutDeleteMiddlewareProcess

type PutDeleteMiddlewareProcess interface {
	ApiDeletePreMiddleware(ctx iris.Context)
}

type PutPreMiddlewareProcess

type PutPreMiddlewareProcess interface {
	ApiPutPreMiddleware(ctx iris.Context)
}

type PutProcess

type PutProcess interface {
	ApiPut(ctx iris.Context)
}

type TableFieldsResp

type TableFieldsResp struct {
	Fields        []structInfo    `json:"fields"`
	AutoIncrement string          `json:"autoincr"`
	Updated       string          `json:"updated"`
	Deleted       string          `json:"deleted"`
	Created       map[string]bool `json:"created"`
	Version       string          `json:"version"`
}

Jump to

Keyboard shortcuts

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