at

package
Version: 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

type AfterMethod struct {
	Annotation

	HttpMethod
}

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

type Annotation

type Annotation struct {
}

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

type AnyMapping

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

type AutoConfiguration struct {
	Annotation

	BaseAnnotation
}

AutoConfiguration is the annotation of auto configuration

type BaseAnnotation

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

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

BaseAnnotation is the base of an annotation

type BeforeMethod

type BeforeMethod struct {
	Annotation

	HttpMethod
}

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

type Component

type Component struct {
	Annotation

	BaseAnnotation
}

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

type Conditional

type Conditional struct {
	Annotation

	BaseAnnotation
}

Conditional annotation

type ConfigurationProperties

type ConfigurationProperties struct {
	Annotation

	BaseAnnotation
}

ConfigurationProperties is the annotation that annotate configuration properties

type Consumes

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

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

type ContextPath struct {
	Annotation

	BaseAnnotation
}

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

type DeleteMapping

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

type ExternalDocs struct {
	Annotation

	Swagger

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

ExternalDocs

type FileServer

type FileServer struct {
	Annotation

	RequestMapping
}

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

type GetMapping

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

type HealthCheckService struct {
	Annotation

	BaseAnnotation
}

HealthCheckService is the annotation for health check service

type HiBootApplication

type HiBootApplication struct {
	Annotation

	BaseAnnotation
}

HiBootApplication

type HttpMethod

type HttpMethod struct {
	Annotation

	BaseAnnotation
}

HttpMethod is the annotation that the http method of a controller

type HttpMethodSubscriber

type HttpMethodSubscriber struct {
	Annotation

	BaseAnnotation
}

type JwtRestController

type JwtRestController struct {
	Annotation

	RestController
	UseJwt
}

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

type Logical

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

type Method

type Method struct {
	Annotation

	BaseAnnotation
}

Method is the annotation that set the RequestMethod of a controller

type Middleware

type Middleware struct {
	Annotation

	BaseAnnotation
}

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

type MiddlewareHandler

type MiddlewareHandler struct {
	Annotation

	BaseAnnotation
}

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

type MiddlewarePostHandler

type MiddlewarePostHandler struct {
	Annotation

	BaseAnnotation
}

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

type Operation

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

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

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

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

type PathVariable struct {
	Annotation

	BaseAnnotation
}

PathVariable the annotation PathVariable

type PostMapping

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

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

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

type RequestBody struct {
	Annotation

	BaseAnnotation
}

RequestBody the annotation RequestBody

type RequestForm

type RequestForm struct {
	Annotation

	BaseAnnotation
}

RequestForm the annotation RequestForm

type RequestMapping

type RequestMapping struct {
	Annotation

	HttpMethod
}

RequestMapping is the annotation that set the RequestMapping of a controller

type RequestParams

type RequestParams struct {
	Annotation

	BaseAnnotation
}

RequestParams the annotation RequestParams

type RequiresAuthentication

type RequiresAuthentication struct {
	Annotation

	BaseAnnotation
}

RequiresAuthentication is the annotation that annotate the method for authorization

type RequiresGuest

type RequiresGuest struct {
	Annotation

	BaseAnnotation
}

RequiresGuest is the annotation that annotate the method for requires guest

type RequiresLogical

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

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

type RequiresRoles struct {
	Annotation

	RequiresLogical
}

RequiresRoles is the annotation that annotate the method for requires roles

type RequiresUser

type RequiresUser struct {
	Annotation

	BaseAnnotation
}

RequiresUser is the annotation that annotate the method for requires users

type Response

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

type ResponseBody struct {
	Annotation

	BaseAnnotation
}

ResponseBody the annotation ResponseBody

type ResponseData

type ResponseData struct {
	Annotation

	BaseAnnotation
}

ResponseData the annotation ResponseData

type RestController

type RestController struct {
	Annotation

	BaseAnnotation
}

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

type Schema

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

type Swagger struct {
	Annotation

	BaseAnnotation
}

Swagger is the annotation group - swagger

type Tag

type Tag struct {
	Annotation

	BaseAnnotation
}

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

type Tags

type Tags struct {
	Annotation

	Swagger

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

Tags

type TraceMapping

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

type UseJwt struct {
	Annotation

	UseMiddleware
}

UseJwt

type UseMiddleware

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
t or T : Toggle theme light dark auto