service

package
v0.0.0-...-f260a3c Latest Latest
Warning

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

Go to latest
Published: Jul 6, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BodyHandler

func BodyHandler(srv *Service, handlers ...types.ParameterOptionHandler) types.RouteOptionHanlder

func ParameterHandler

func ParameterHandler(srv *Service, handlers ...types.ParameterOptionHandler) types.RouteOptionHanlder

func RouteDescriptionHandler

func RouteDescriptionHandler(file *ast.File) types.RouteOptionHanlder

Types

type IParameter

type IParameter interface {
	NameParam() string
	Type() string
	EqualTo(interface{}) bool
}

type Info

type Info struct {
	Title   string `json:"title"`
	Version string `json:"version"`
}

type Parameter

type Parameter struct {
	In          string           `json:"in"`
	Name        string           `json:"name"`
	Required    bool             `json:"required"`
	Minimum     int              `json:"minimum,omitempty"`
	Description string           `json:"description,omitempty"`
	RequestBody *types.Reference `json:"requestBody,omitempty"`
	Schema      types.Type       `json:"schema,omitempty"`
}

func NewParameter

func NewParameter(paramType string, t types.Call) Parameter

func NewParameter(paramType string, t string, args []ast.Expr) Parameter {

func (Parameter) EqualTo

func (i Parameter) EqualTo(p interface{}) bool

func (Parameter) NameParam

func (i Parameter) NameParam() string

func (Parameter) Type

func (i Parameter) Type() string

type Parser

type Parser interface {
	FindModel(ast.SelectorExpr) types.Type
	UnwrapImportedType(types.ImportedType) (types.Type, error)
}

type Server

type Server struct {
	URL         string `json:"url"`
	Description string `json:"description"`
}

type Service

type Service struct {
	Components types.Components
	Paths      map[string]map[string]types.Route
	// contains filtered or unexported fields
}

func New

func New(parser Parser, receiver types.Type, prefix string) *Service

func (*Service) AddParameter

func (srv *Service) AddParameter(route *types.Route, param types.IParameter)

func (*Service) NewInBody

func (srv *Service) NewInBody(route *types.Route, arg types.Type) (string, types.Type)

func (*Service) Parse

func (srv *Service) Parse() error

Jump to

Keyboard shortcuts

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