entity

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsSchemaType

func IsSchemaType(value string) bool

Types

type BodyProperty

type BodyProperty struct {
	*Schema
	Encoding Encoding
}

type Encoding

type Encoding string
const ENCODING_JSON Encoding = "json"
const ENCODING_TEXT Encoding = "json"
const ENCODING_URL Encoding = "form"
const ENCODING_XML Encoding = "xml"

type Endpoint

type Endpoint struct {
	Name     string
	Path     string
	Verb     Verb
	Params   []ParamProperty
	Query    map[string]QueryProperty
	Header   map[string]HeaderProperty
	Body     BodyProperty
	Response Response
	Security []Security
}

type Enum added in v0.0.1

type Enum struct {
	Options []EnumOption
}

type EnumOption added in v0.0.1

type EnumOption struct {
	Key   string
	Value string
}

type Field

type Field struct {
	*Schema
	Name     string
	TypeName string
	Tag      string
}

func NewField

func NewField(name string, schema *Schema, tag string) Field

type HeaderProperty

type HeaderProperty struct {
	Name string
	Key  string
	Type string
}

type ParamProperty

type ParamProperty struct {
	Name string
	Key  string
	Type string
}

type QueryProperty

type QueryProperty struct {
	*Schema
	Name string
	Key  string
}

type Response

type Response struct {
	Options     []ResponseOption
	Default     bool
	DefaultCode int
}

type ResponseOption

type ResponseOption struct {
	Code     int
	Name     string
	Type     *Schema
	Redirect bool
}

type Schema

type Schema struct {
	Id      string
	Name    string
	Type    SchemaType
	Fields  []Field
	Items   *Schema
	Display bool
	*Enum
}

func NewArraySchema

func NewArraySchema(
	id string,
	name string,
	items *Schema,
	display bool,
) Schema

func NewBooleanSchema

func NewBooleanSchema(
	id string,
	name string,
	display bool,
) Schema

func NewEnumSchema added in v0.0.1

func NewEnumSchema(
	id string,
	name string,
	display bool,
	options *Enum,
) Schema

func NewFloatSchema

func NewFloatSchema(
	id string,
	name string,
	display bool,
) Schema

func NewIntegerSchema

func NewIntegerSchema(
	id string,
	name string,
	display bool,
) Schema

func NewObjectSchema

func NewObjectSchema(
	id string,
	name string,
	fields []Field,
	display bool,
) Schema

func NewStringSchema

func NewStringSchema(
	id string,
	name string,
	display bool,
) Schema

func (*Schema) Show

func (s *Schema) Show(display bool)

func (*Schema) Sort

func (s *Schema) Sort()

type SchemaType

type SchemaType string
const TYPE_ARRAY SchemaType = "array"
const TYPE_BOOLEAN SchemaType = "bool"
const TYPE_INTEGER SchemaType = "int"
const TYPE_NUMBER SchemaType = "float32"
const TYPE_OBJECT SchemaType = "object"
const TYPE_STRING SchemaType = "string"

func NewSchemaType

func NewSchemaType(value string) SchemaType

func (SchemaType) String

func (s SchemaType) String() string

type Security added in v0.0.2

type Security struct {
	Type SecurityType
}

type SecurityType added in v0.0.2

type SecurityType string
const SECURITY_TYPE_BASIC SecurityType = "basic"
const SECURITY_TYPE_BEARER SecurityType = "bearer"
const SECURITY_TYPE_COOKIE SecurityType = "cookie"

type TemplateData

type TemplateData struct {
	Package   string
	Structs   []*Schema
	Endpoints []*Endpoint
}

type Verb

type Verb string
const VERB_CONNECT Verb = "CONNECT"
const VERB_DELETE Verb = "DELETE"
const VERB_GET Verb = "GET"
const VERB_HEAD Verb = "HEAD"
const VERB_OPTIONS Verb = "OPTIONS"
const VERB_PATCH Verb = "PATCH"
const VERB_POST Verb = "POST"
const VERB_PUT Verb = "PUT"
const VERB_TRACE Verb = "TRACE"

Jump to

Keyboard shortcuts

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