at

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 22, 2020 License: Apache-2.0 Imports: 0 Imported by: 0

Documentation

Overview

Package at provides annotations for struct, function, or method

Package at provides annotations for web RestController

Copyright 2018~now John Deng (hi.devops.io@gmail.com).

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AfterMethod added in v1.3.0

type AfterMethod struct {
	Annotation

	HttpMethod
}

AfterMethod is the annotation that set the called after the http method of a controller

type Annotation added in v1.2.1

type Annotation struct {
}

Annotation is an empty struct that indicates the struct as an annotation

type AnyMapping added in v1.2.0

type AnyMapping struct {
	Annotation

	RequestMapping
	AtMethod string `value:"ANY" at:"method" json:"-"`
}

AnyMapping is the annotation that set the AnyMapping of a controller

type AutoConfiguration added in v0.9.7

type AutoConfiguration struct {
	Annotation

	BaseAnnotation
}

AutoConfiguration is the annotation of auto configuration

type BaseAnnotation added in v1.3.0

type BaseAnnotation struct {
	Annotation `json:"-"`

	AtValue string `json:"-" at:"value"`
}

BaseAnnotation is the base of an annotation

type BeforeMethod added in v1.3.0

type BeforeMethod struct {
	Annotation

	HttpMethod
}

BeforeMethod is the annotation that set the called before the http method of a controller

type Component added in v0.11.0

type Component struct {
	Annotation

	BaseAnnotation
}

Component is the annotation that the dependency is injected in app init.

type Conditional added in v1.3.0

type Conditional struct {
	Annotation

	BaseAnnotation
}

Conditional annotation

type ConfigurationProperties added in v0.9.8

type ConfigurationProperties struct {
	Annotation

	BaseAnnotation
}

ConfigurationProperties is the annotation that annotate configuration properties

type Consumes added in v1.3.0

type Consumes struct {
	Annotation

	Swagger

	AtValues []string `at:"values" json:"-"`
}

Consumes corresponds to the `consumes` field of the operation. Takes in comma-separated values of content types. For example, "application/json, application/xml" would suggest this API Resource accepts JSON and XML input. example:

at struct {
   at.Consumes    `values:"application/json,application/xml"`
}

type ContextAware added in v0.11.0

type ContextAware struct {
	Annotation

	BaseAnnotation
}

ContextAware is the annotation that it is the ability of a component to be injected when method of Rest Controller is requested.

type Example struct {
  at.ContextAware
  ...
}

type ContextPath added in v0.11.0

type ContextPath struct {
	Annotation

	BaseAnnotation
}

ContextPath is the annotation that set the context path of a controller

type DeleteMapping added in v1.2.0

type DeleteMapping struct {
	Annotation

	RequestMapping
	AtMethod string `method:"DELETE" at:"method" json:"-"`
}

DeleteMapping is the annotation that set the DeleteMapping of a controller

type ExternalDocs added in v1.3.0

type ExternalDocs struct {
	Annotation

	Swagger

	AtDescription string `at:"description" json:"-"`
	AtURL         string `at:"url" json:"-"`
}

ExternalDocs

type FileServer added in v1.3.0

type FileServer struct {
	Annotation

	RequestMapping
}

StaticResource is the annotation that set the StaticResource of a controller value: static resource dir

type GetMapping added in v1.2.0

type GetMapping struct {
	Annotation

	RequestMapping
	AtMethod string `method:"GET" at:"method" json:"-"`
}

GetMapping is the annotation that set the GetMapping of a controller

type Header struct {
	Annotation

	Swagger

	AtType        string `at:"type" json:"-"`
	AtFormat      string `at:"format" json:"-"`
	AtDescription string `at:"description" json:"-"`
}

Header is the annotation that annotate the header

type HealthCheckService added in v0.10.2

type HealthCheckService struct {
	Annotation

	BaseAnnotation
}

HealthCheckService is the annotation for health check service

type HiBootApplication added in v1.3.0

type HiBootApplication struct {
	Annotation

	BaseAnnotation
}

HiBootApplication

type HttpMethod added in v1.3.0

type HttpMethod struct {
	Annotation

	BaseAnnotation
}

HttpMethod is the annotation that the http method of a controller

type HttpMethodSubscriber added in v1.3.0

type HttpMethodSubscriber struct {
	Annotation

	BaseAnnotation
}

type JwtRestController added in v0.11.0

type JwtRestController struct {
	Annotation

	RestController
	UseJwt
}

JwtRestController is the annotation that declare current controller is the RESTful Controller with JWT support

type Logical added in v1.4.0

type Logical string
const (
	AND Logical = "and"
	OR  Logical = "or"
)

type Method added in v1.2.0

type Method struct {
	Annotation

	BaseAnnotation
}

Method is the annotation that set the RequestMethod of a controller

type Middleware added in v1.3.0

type Middleware struct {
	Annotation

	BaseAnnotation
}

Middleware is the annotation that annotate the controller or method use middleware

type MiddlewareHandler added in v1.3.0

type MiddlewareHandler struct {
	Annotation

	BaseAnnotation
}

MiddlewareHandler is the annotation that annotate the controller or method use middleware

type MiddlewarePostHandler added in v1.4.0

type MiddlewarePostHandler struct {
	Annotation

	BaseAnnotation
}

MiddlewarePostHandler is the annotation that annotate the controller or method use middleware

type Operation added in v1.3.0

type Operation struct {
	Annotation

	Swagger

	AtID          string `at:"id" json:"-"`
	AtDescription string `at:"description" json:"-"`
	AtSummary     string `at:"summary" json:"-"`
	AtDeprecated  bool   `at:"deprecated" json:"-"`
}

Operation Describes an operation or typically a HTTP method against a specific path. Operations with equivalent paths are grouped in a single Operation Object. A combination of a HTTP method and a path creates a unique operation. example:

func (c *) CreateEmployee(at struct{
    at.PostMapping `value:"/"`
    at.Operation   `id:"Create Employee" description:"This is the employee creation api"`
  }, request EmployeeRequest) {

  ...
}

type OptionsMapping added in v1.2.0

type OptionsMapping struct {
	Annotation

	RequestMapping
	AtMethod string `method:"OPTIONS" at:"method" json:"-"`
}

OptionsMapping is the annotation that set the OptionsMapping of a controller

type Parameter added in v1.3.0

type Parameter struct {
	Annotation

	Swagger

	AtName        string `at:"name" json:"-"`
	AtType        string `at:"type" json:"-"`
	AtIn          string `at:"in" json:"-"`
	AtDescription string `at:"description" json:"-"`
}

ApiParam annotation to add additional meta-data for operation parameters

func (c *) CreateEmployee(at struct{
    at.PostMapping `value:"/"`
    at.Parameter `value:"Employee object store in database table" required:"true"`
  }, request EmployeeRequest) {

  ...
}

Parameter

type PatchMapping added in v1.2.1

type PatchMapping struct {
	Annotation

	RequestMapping
	AtMethod string `method:"PATCH" at:"method" json:"-"`
}

PatchMapping is the annotation that set the PatchMapping of a controller

type PathVariable added in v1.3.0

type PathVariable struct {
	Annotation

	BaseAnnotation
}

PathVariable the annotation PathVariable

type PostMapping added in v1.2.0

type PostMapping struct {
	Annotation

	RequestMapping
	AtMethod string `method:"POST" at:"method" json:"-"`
}

PostMapping is the annotation that set the PostMapping of a controller

type Produces added in v1.3.0

type Produces struct {
	Annotation

	Swagger

	AtValues []string `at:"values" json:"-"`
}

Produces corresponds to the `produces` field of the operation. Takes in comma-separated values of content types. For example, "application/json, application/xml" would suggest this operation generates JSON and XML output. example:

at struct {
   at.Consumes    `values:"application/json,application/xml"`
}

type PutMapping added in v1.2.0

type PutMapping struct {
	Annotation

	RequestMapping
	AtMethod string `method:"PUT" at:"method" json:"-"`
}

PutMapping is the annotation that set the PutMapping of a controller

type Qualifier

type Qualifier struct {
	Annotation

	BaseAnnotation
}

Qualifier is the annotation that used for disambiguate the references.

type RequestBody added in v0.11.0

type RequestBody struct {
	Annotation

	BaseAnnotation
}

RequestBody the annotation RequestBody

type RequestForm added in v0.11.0

type RequestForm struct {
	Annotation

	BaseAnnotation
}

RequestForm the annotation RequestForm

type RequestMapping added in v1.2.0

type RequestMapping struct {
	Annotation

	HttpMethod
}

RequestMapping is the annotation that set the RequestMapping of a controller

type RequestParams added in v0.11.0

type RequestParams struct {
	Annotation

	BaseAnnotation
}

RequestParams the annotation RequestParams

type RequiresAuthentication added in v1.4.0

type RequiresAuthentication struct {
	Annotation

	BaseAnnotation
}

RequiresAuthentication is the annotation that annotate the method for authorization

type RequiresGuest added in v1.4.0

type RequiresGuest struct {
	Annotation

	BaseAnnotation
}

RequiresGuest is the annotation that annotate the method for requires guest

type RequiresLogical added in v1.4.0

type RequiresLogical struct {
	Annotation

	BaseAnnotation

	// AtLogical is the logical operator, default value is 'and'
	AtLogical Logical `json:"-" at:"logical" logical:"and"` // default value is and
}

RequiresLogical is the annotation that annotate the method for requires logical

type RequiresPermissions added in v1.4.0

type RequiresPermissions struct {
	Annotation

	RequiresLogical

	// AtValues hold the permission values as an array,  e.g. `values:"user:read,team:read"`
	AtValues []string `at:"values" json:"-"`

	// AtType is for data permission, user can specify his/her own type and then implement it in middleware, e.g. `type:"pagination"`
	AtType string `json:"-" at:"type"`

	// AtIn is the input field name of query parameters, e.g. `in:"page,per_page"`; page,per_page is the default values that indicate
	AtIn []string `json:"-" at:"in"`

	// AtOut is the output field name of query parameters, e.g. `out:"expr"` <where in (1,2,3)>; expr is the default value, it can be any query parameters field name
	AtOut []string `json:"-" at:"out"`
}

RequiresPermissions is the annotation that annotate the method for requires permissions

type RequiresRoles added in v1.4.0

type RequiresRoles struct {
	Annotation

	RequiresLogical
}

RequiresRoles is the annotation that annotate the method for requires roles

type RequiresUser added in v1.4.0

type RequiresUser struct {
	Annotation

	BaseAnnotation
}

RequiresUser is the annotation that annotate the method for requires users

type Response added in v1.3.0

type Response struct {
	Annotation

	Swagger

	AtCode        int    `at:"code" json:"-"`
	AtDescription string `at:"description" json:"-"`
}

Response is the response type of the operation. example:

Responses struct {
	StatusOK struct {
		at.Response `code:"200" description:"returns a greeting"`
		at.Schema   `type:"string" description:"contains the actual greeting as plain text"`
	}
	StatusNotFound struct {
		at.Response `code:"404" description:"greeter is not available"`
		at.Schema   `type:"string" description:"Report 'not found' error message"`
	}
}

type ResponseBody added in v0.11.0

type ResponseBody struct {
	Annotation

	BaseAnnotation
}

ResponseBody the annotation ResponseBody

type ResponseData added in v0.11.0

type ResponseData struct {
	Annotation

	BaseAnnotation
}

ResponseData the annotation ResponseData

type RestController added in v0.9.7

type RestController struct {
	Annotation

	BaseAnnotation
}

RestController is the annotation that declare current controller is the RESTful Controller

type Schema added in v1.3.0

type Schema struct {
	Annotation

	Swagger

	AtType        string `at:"type" json:"-"`
	AtDescription string `at:"description" json:"-"`
}

Schema is the annotation that annotate Response or Parameter's properties example:

Responses struct {
	StatusOK struct {
		at.Response `code:"200" description:"returns a greeting"`
		at.Schema   `type:"string" description:"contains the actual greeting as plain text"`
	}
	StatusNotFound struct {
		at.Response `code:"404" description:"greeter is not available"`
		at.Schema   `type:"string" description:"Report 'not found' error message"`
	}
}

type Swagger added in v1.3.0

type Swagger struct {
	Annotation

	BaseAnnotation
}

Swagger is the annotation group - swagger

type Tag added in v1.2.0

type Tag struct {
	Annotation

	BaseAnnotation
}

Tag the annotation Tag, tell the injector that the struct implements a tag

type Tags added in v1.3.0

type Tags struct {
	Annotation

	Swagger

	AtValues []string `at:"values" json:"-"`
}

Tags

type TraceMapping added in v1.2.1

type TraceMapping struct {
	Annotation

	RequestMapping
	AtMethod string `method:"TRACE" at:"method" json:"-"`
}

TraceMapping is the annotation that set the TraceMapping of a controller

type UseJwt added in v1.3.0

type UseJwt struct {
	Annotation

	UseMiddleware
}

UseJwt

type UseMiddleware added in v1.3.0

type UseMiddleware struct {
	Annotation

	Conditional
}

UseMiddleware is the annotation that that annotate the controller or method use middleware based on condition

Jump to

Keyboard shortcuts

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