catalog

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const JDocExchangeVersion = "2.0.0"

Variables

This section is empty.

Functions

func Annotation

func Annotation(s string) string

func StrPtr

func StrPtr(s string) *string

Types

type Catalog

type Catalog struct {
	// Info represent "INFO" directive structure.
	Info *Info

	// Servers contains information about servers.
	Servers *Servers

	// UserTypes contains information about defined user types.
	UserTypes *UserTypes

	// UserEnums contains information about defined user enums.
	UserEnums *UserRules

	Interactions *Interactions

	Tags *Tags

	JSightVersion string
}

Catalog is the main result of processing .jst file, represents all accumulated Api data more closely to API terms. Has no direct connection to Directives but operates with models with similar structure, but in API terms. Has flat URL structure, each URL is unique and indicates a separate Resource. Each Resource has Requests — available http methods and their properties. Each Resource or Request has it its own complex properties, which can be added through dedicated methods.

func NewCatalog

func NewCatalog() *Catalog

func (*Catalog) AddBaseURL

func (c *Catalog) AddBaseURL(serverName, path string) error

func (*Catalog) AddDescriptionToHTTPMethod

func (c *Catalog) AddDescriptionToHTTPMethod(d directive.Directive, text string) error

func (*Catalog) AddDescriptionToInfo

func (c *Catalog) AddDescriptionToInfo(text string) error

func (*Catalog) AddDescriptionToJsonRpcMethod

func (c *Catalog) AddDescriptionToJsonRpcMethod(d directive.Directive, text string) error

func (*Catalog) AddDescriptionToTag

func (c *Catalog) AddDescriptionToTag(name, description string) error

func (*Catalog) AddEnum

func (c *Catalog) AddEnum(d *directive.Directive, e *enum.Enum) *jerr.JApiError

func (*Catalog) AddHTTPMethod

func (c *Catalog) AddHTTPMethod(d directive.Directive) *jerr.JApiError

func (*Catalog) AddInfo

func (c *Catalog) AddInfo(d directive.Directive) error

func (*Catalog) AddJSight

func (c *Catalog) AddJSight(version string) error

func (*Catalog) AddJsonRpcMethod

func (c *Catalog) AddJsonRpcMethod(d directive.Directive) *jerr.JApiError

func (*Catalog) AddJsonRpcParams

func (c *Catalog) AddJsonRpcParams(s *ExchangeJSightSchema, d directive.Directive) error

func (*Catalog) AddJsonRpcResult

func (c *Catalog) AddJsonRpcResult(s *ExchangeJSightSchema, d directive.Directive) error

func (*Catalog) AddQueryToCurrentMethod

func (c *Catalog) AddQueryToCurrentMethod(d directive.Directive, q Query) error

func (*Catalog) AddRequest

func (c *Catalog) AddRequest(d directive.Directive) error

func (*Catalog) AddRequestBody

func (c *Catalog) AddRequestBody(s ExchangeSchema, f SerializeFormat, d directive.Directive) error

func (*Catalog) AddRequestHeaders

func (c *Catalog) AddRequestHeaders(s *ExchangeJSightSchema, d directive.Directive) error

func (*Catalog) AddResponse

func (c *Catalog) AddResponse(code, annotation string, d directive.Directive) error

func (*Catalog) AddResponseBody

func (c *Catalog) AddResponseBody(
	schemaBytes bytes.Bytes,
	bodyFormat SerializeFormat,
	sn notation.SchemaNotation,
	d directive.Directive,
	tt *UserSchemas,
	rr map[string]schema.Rule,
) *jerr.JApiError

func (*Catalog) AddResponseHeaders

func (c *Catalog) AddResponseHeaders(s *ExchangeJSightSchema, d directive.Directive) error

func (*Catalog) AddServer

func (c *Catalog) AddServer(name, annotation string) error

func (*Catalog) AddTag

func (c *Catalog) AddTag(name, title string) error

func (*Catalog) AddTitle

func (c *Catalog) AddTitle(name string) error

func (*Catalog) AddType

func (c *Catalog) AddType(
	d directive.Directive,
	coreUserTypes *UserSchemas,
) *jerr.JApiError

func (*Catalog) AddVersion

func (c *Catalog) AddVersion(version string) error

func (*Catalog) MarshalJSON

func (c *Catalog) MarshalJSON() ([]byte, error)

func (*Catalog) Read

func (*Catalog) Read(coords directive.Coords) bytes.Bytes

func (*Catalog) ToJson

func (c *Catalog) ToJson() ([]byte, error)

func (*Catalog) ToJsonIndent

func (c *Catalog) ToJsonIndent() ([]byte, error)

type ExchangeContent

type ExchangeContent struct {
	// Key is key of object element.
	Key *string

	// TokenType a JSON type.
	TokenType string

	// Type a JSight type.
	Type string

	// ScalarValue contains scalar value from the example.
	// Make sense only for scalar types like string, integer, and etc.
	ScalarValue string

	// InheritedFrom a user defined type from which this property is inherited.
	InheritedFrom string

	// Note a user note.
	Note string

	// Rules a list of attached rules.
	Rules *Rules

	// Children represent available object properties or array items.
	Children []*ExchangeContent

	// IsKeyUserTypeRef indicates that this is an object property which is described
	// by user defined type.
	IsKeyUserTypeRef bool

	// Optional indicates that this schema item is option or not.
	Optional bool
}

func (*ExchangeContent) IsObjectHaveProperty

func (c *ExchangeContent) IsObjectHaveProperty(k string) bool

func (*ExchangeContent) MarshalJSON

func (c *ExchangeContent) MarshalJSON() (b []byte, err error)

func (*ExchangeContent) ObjectProperty

func (c *ExchangeContent) ObjectProperty(k string) *ExchangeContent

func (*ExchangeContent) ToUsedUserTypes

func (c *ExchangeContent) ToUsedUserTypes(uut *StringSet)

func (*ExchangeContent) Unshift

func (c *ExchangeContent) Unshift(v *ExchangeContent)

type ExchangeJSightSchema

type ExchangeJSightSchema struct {
	*jschema.JSchema
	// contains filtered or unexported fields
}

func NewExchangeJSightSchema

func NewExchangeJSightSchema[T bytes.ByteKeeper](
	b T,
	coreUserTypes *UserSchemas,
	coreRules map[string]schema.Rule,
	catalogUserTypes *UserTypes,
	options ...jschema.Option,
) (*ExchangeJSightSchema, error)

func (*ExchangeJSightSchema) CastToObject added in v0.2.0

func (e *ExchangeJSightSchema) CastToObject() *ExchangeJSightSchema

func (*ExchangeJSightSchema) Compile

func (e *ExchangeJSightSchema) Compile() (err error)

func (*ExchangeJSightSchema) Example

func (e *ExchangeJSightSchema) Example() ([]byte, error)

func (*ExchangeJSightSchema) MarshalJSON

func (e *ExchangeJSightSchema) MarshalJSON() ([]byte, error)

func (*ExchangeJSightSchema) Notation added in v0.2.0

type ExchangePseudoSchema

type ExchangePseudoSchema struct {
	schema.Schema
	// contains filtered or unexported fields
}

func (ExchangePseudoSchema) MarshalJSON

func (e ExchangePseudoSchema) MarshalJSON() ([]byte, error)

func (ExchangePseudoSchema) Notation

type ExchangeRegexSchema

type ExchangeRegexSchema struct {
	*regex.RSchema
}

func NewExchangeRegexSchema added in v0.2.0

func NewExchangeRegexSchema(regexStr bytes.Bytes) (*ExchangeRegexSchema, error)

func (ExchangeRegexSchema) MarshalJSON

func (e ExchangeRegexSchema) MarshalJSON() ([]byte, error)

func (ExchangeRegexSchema) Notation added in v0.2.0

type ExchangeSchema

type ExchangeSchema interface {
	schema.Schema
	MarshalJSON() ([]byte, error)
	Notation() notation.SchemaNotation
}

type HTTPInteraction

type HTTPInteraction struct {
	Id            string         `json:"id"`
	Protocol      Protocol       `json:"protocol"`
	HttpMethod    HTTPMethod     `json:"httpMethod"`
	PathVal       Path           `json:"path"`
	PathVariables *PathVariables `json:"pathVariables,omitempty"`
	Tags          []TagName      `json:"tags"`
	Annotation    *string        `json:"annotation,omitempty"`
	Description   *string        `json:"description,omitempty"`
	Query         *Query         `json:"query,omitempty"`
	Request       *HTTPRequest   `json:"request,omitempty"`
	Responses     []HTTPResponse `json:"responses,omitempty"`
}

func (HTTPInteraction) Path

func (h HTTPInteraction) Path() Path

func (*HTTPInteraction) SetPathVariables

func (h *HTTPInteraction) SetPathVariables(p *PathVariables)

type HTTPInteractionID

type HTTPInteractionID struct {
	// contains filtered or unexported fields
}

func (HTTPInteractionID) MarshalText

func (h HTTPInteractionID) MarshalText() ([]byte, error)

func (HTTPInteractionID) Method

func (h HTTPInteractionID) Method() HTTPMethod

func (HTTPInteractionID) Path

func (h HTTPInteractionID) Path() Path

func (HTTPInteractionID) Protocol

func (h HTTPInteractionID) Protocol() Protocol

func (HTTPInteractionID) String

func (h HTTPInteractionID) String() string

type HTTPMethod

type HTTPMethod uint8
const (
	GET HTTPMethod = iota
	POST
	PUT
	PATCH
	DELETE
	OPTIONS
)

func NewHTTPMethod

func NewHTTPMethod(de directive.Enumeration) (HTTPMethod, error)

func NewHTTPMethodFromString

func NewHTTPMethodFromString(s string) (HTTPMethod, error)

func (HTTPMethod) MarshalText

func (e HTTPMethod) MarshalText() ([]byte, error)

func (HTTPMethod) String

func (e HTTPMethod) String() string

type HTTPRequest

type HTTPRequest struct {
	*HTTPRequestHeaders `json:"headers,omitempty"`
	*HTTPRequestBody    `json:"body,omitempty"`
	Directive           directive.Directive `json:"-"`
}

type HTTPRequestBody

type HTTPRequestBody struct {
	Format    SerializeFormat     `json:"format"`
	Schema    ExchangeSchema      `json:"schema"`
	Directive directive.Directive `json:"-"`
}

type HTTPRequestHeaders

type HTTPRequestHeaders struct {
	Schema    *ExchangeJSightSchema `json:"schema"`
	Directive directive.Directive   `json:"-"`
}

type HTTPResponse

type HTTPResponse struct {
	Code       string               `json:"code"`
	Annotation string               `json:"annotation,omitempty"`
	Headers    *HTTPResponseHeaders `json:"headers,omitempty"`
	Body       *HTTPResponseBody    `json:"body"`
	Directive  directive.Directive  `json:"-"`
}

type HTTPResponseBody

type HTTPResponseBody struct {
	Format    SerializeFormat     `json:"format"`
	Schema    ExchangeSchema      `json:"schema"`
	Directive directive.Directive `json:"-"`
}

type HTTPResponseHeaders

type HTTPResponseHeaders struct {
	Schema    *ExchangeJSightSchema `json:"schema"`
	Directive directive.Directive   `json:"-"`
}

type Info

type Info struct {
	Title       string              `json:"title,omitempty"`
	Version     string              `json:"version,omitempty"`
	Description *string             `json:"description,omitempty"`
	Directive   directive.Directive `json:"-"`
}

Info general info about api

type Interaction

type Interaction interface {
	Path() Path
	// contains filtered or unexported methods
}

type InteractionID

type InteractionID interface {
	Protocol() Protocol
	Path() Path
	String() string
	MarshalText() ([]byte, error)
}

type Interactions

type Interactions struct {
	// contains filtered or unexported fields
}

Interactions represent available resource methods. gen:OrderedMap

func (*Interactions) Each

func (m *Interactions) Each(fn eachInteractionsFunc) error

Each iterates and perform given function on each item in the map.

func (*Interactions) EachReverse

func (m *Interactions) EachReverse(fn eachInteractionsFunc) error

EachReverse act almost the same as Each but in reverse order.

func (*Interactions) EachSafe

func (m *Interactions) EachSafe(fn eachSafeInteractionsFunc)

func (*Interactions) Find

func (m *Interactions) Find(fn findInteractionsFunc) (InteractionsItem, bool)

Find finds first matched item from the map.

func (*Interactions) Get

Get gets a value by key.

func (*Interactions) GetValue

func (m *Interactions) GetValue(k InteractionID) Interaction

GetValue gets a value by key.

func (*Interactions) Has

func (m *Interactions) Has(k InteractionID) bool

Has checks that specified key is set.

func (*Interactions) Len

func (m *Interactions) Len() int

Len returns count of values.

func (*Interactions) Map

func (m *Interactions) Map(fn mapInteractionsFunc) error

Map iterates and changes values in the map.

func (*Interactions) MarshalJSON

func (m *Interactions) MarshalJSON() ([]byte, error)

func (*Interactions) Set

func (m *Interactions) Set(k InteractionID, v Interaction)

Set sets a value with specified key.

func (*Interactions) SetToTop

func (m *Interactions) SetToTop(k InteractionID, v Interaction)

SetToTop do the same as Set, but new key will be placed on top of the order map.

func (*Interactions) Update

func (m *Interactions) Update(k InteractionID, fn func(v Interaction) Interaction)

Update updates a value with specified key.

type InteractionsItem

type InteractionsItem struct {
	Key   InteractionID
	Value Interaction
}

InteractionsItem represent single data from the Interactions.

type JSchemaObject

type JSchemaObject struct {
	*jschema.JSchema
}

func (*JSchemaObject) ObjectFirstLevelProperties

func (s *JSchemaObject) ObjectFirstLevelProperties(ut map[string]*jschema.JSchema) map[string]ischema.Node

func (*JSchemaObject) ObjectProperty

func (s *JSchemaObject) ObjectProperty(key string) (ischema.Node, bool)

func (*JSchemaObject) RootObjectNode

func (s *JSchemaObject) RootObjectNode() (*ischema.ObjectNode, bool)

type JsonRpcInteraction

type JsonRpcInteraction struct {
	Id          string         `json:"id"`
	Protocol    Protocol       `json:"protocol"`
	PathVal     Path           `json:"path"`
	Method      string         `json:"method"`
	Tags        []TagName      `json:"tags"`
	Annotation  *string        `json:"annotation,omitempty"`
	Description *string        `json:"description,omitempty"`
	Params      *jsonRpcParams `json:"params,omitempty"`
	Result      *jsonRpcResult `json:"result,omitempty"`
}

func (JsonRpcInteraction) Path

func (j JsonRpcInteraction) Path() Path

type JsonRpcInteractionId

type JsonRpcInteractionId struct {
	// contains filtered or unexported fields
}

func (JsonRpcInteractionId) MarshalText

func (j JsonRpcInteractionId) MarshalText() ([]byte, error)

func (JsonRpcInteractionId) Path

func (j JsonRpcInteractionId) Path() Path

func (JsonRpcInteractionId) Protocol

func (j JsonRpcInteractionId) Protocol() Protocol

func (JsonRpcInteractionId) String

func (j JsonRpcInteractionId) String() string

type ObjectBuilder

type ObjectBuilder struct {
	// contains filtered or unexported fields
}

func NewObjectBuilder

func NewObjectBuilder() ObjectBuilder

NewObjectBuilder used only for building Path variables in the JSight API library

func (ObjectBuilder) AddProperty

func (b ObjectBuilder) AddProperty(key string, node ischema.Node, types map[string]ischema.Type)

func (ObjectBuilder) AddType

func (b ObjectBuilder) AddType(name string, sc schema.Schema)

func (ObjectBuilder) Build

func (b ObjectBuilder) Build() *jschema.JSchema

func (ObjectBuilder) Len

func (b ObjectBuilder) Len() int

func (ObjectBuilder) UserTypeNames

func (b ObjectBuilder) UserTypeNames() []string

type Path

type Path string

func (Path) String

func (p Path) String() string

type PathVariables

type PathVariables struct {
	Schema *ExchangeJSightSchema `json:"schema"`
}

type PathVariablesBuilder

type PathVariablesBuilder struct {
	// contains filtered or unexported fields
}

func NewPathVariablesBuilder

func NewPathVariablesBuilder(catalogUserTypes *UserTypes) PathVariablesBuilder

func (PathVariablesBuilder) AddProperty

func (b PathVariablesBuilder) AddProperty(key string, node ischema.Node, types map[string]ischema.Type)

func (PathVariablesBuilder) Build

func (PathVariablesBuilder) Len

func (b PathVariablesBuilder) Len() int

type Prop

type Prop struct {
	Parameter string
	ASTNode   schema.ASTNode
	Directive directive.Directive
}

type Protocol

type Protocol string
const (
	HTTP    Protocol = "http"
	JsonRpc Protocol = "json-rpc-2.0"
)

type Query

type Query struct {
	Example   string                `json:"example,omitempty"`
	Format    string                `json:"format"`
	Schema    *ExchangeJSightSchema `json:"schema"`
	Directive directive.Directive   `json:"-"`
}

func NewQuery

func NewQuery(d directive.Directive) Query

type Rule

type Rule struct {
	Key       string
	TokenType RuleTokenType

	// ScalarValue specified only if "tokenType" specifies "string", "number",
	// "boolean", "annotation", "null" or "reference".
	ScalarValue string

	// Note may contain line breaks.
	Note string

	// Children specified only if tokenType: "array" or "object".
	Children []Rule
}

func (Rule) MarshalJSON

func (r Rule) MarshalJSON() (b []byte, err error)

type RuleTokenType

type RuleTokenType string
const (
	RuleTokenTypeObject     RuleTokenType = "object"
	RuleTokenTypeArray      RuleTokenType = "array"
	RuleTokenTypeString     RuleTokenType = "string"
	RuleTokenTypeNumber     RuleTokenType = "number"
	RuleTokenTypeBoolean    RuleTokenType = "boolean"
	RuleTokenTypeNull       RuleTokenType = "null"
	RuleTokenTypeAnnotation RuleTokenType = "annotation"
	RuleTokenTypeReference  RuleTokenType = "reference"
)

type Rules

type Rules struct {
	// contains filtered or unexported fields
}

func NewRules

func NewRules(d []Rule) *Rules

func (*Rules) Each

func (rr *Rules) Each(fn findRulesFunc) error

func (*Rules) Get

func (rr *Rules) Get(k string) (Rule, bool)

func (*Rules) Has

func (rr *Rules) Has(k string) bool

func (*Rules) Len

func (rr *Rules) Len() int

func (*Rules) MarshalJSON

func (rr *Rules) MarshalJSON() ([]byte, error)

type RulesBuilder

type RulesBuilder struct {
	// contains filtered or unexported fields
}

func (*RulesBuilder) Append

func (b *RulesBuilder) Append(r Rule)

func (*RulesBuilder) Rules

func (b *RulesBuilder) Rules() *Rules

func (*RulesBuilder) Set

func (b *RulesBuilder) Set(k string, r Rule)

type SerializeFormat

type SerializeFormat string
const (
	SerializeFormatJSON        SerializeFormat = "json"
	SerializeFormatPlainString SerializeFormat = "plainString"
	SerializeFormatBinary      SerializeFormat = "binary"
)

func SchemaSerializeFormat

func SchemaSerializeFormat(n notation.SchemaNotation) (SerializeFormat, error)

type Server

type Server struct {
	BaseUrlVariables *baseURLVariables `json:"baseUrlVariables,omitempty"`
	Annotation       string            `json:"annotation,omitempty"`
	BaseUrl          string            `json:"baseUrl"`
}

type Servers

type Servers struct {
	// contains filtered or unexported fields
}

Servers represent available servers. gen:OrderedMap

func (*Servers) Each

func (m *Servers) Each(fn eachServersFunc) error

Each iterates and perform given function on each item in the map.

func (*Servers) EachReverse

func (m *Servers) EachReverse(fn eachServersFunc) error

EachReverse act almost the same as Each but in reverse order.

func (*Servers) EachSafe

func (m *Servers) EachSafe(fn eachSafeServersFunc)

func (*Servers) Find

func (m *Servers) Find(fn findServersFunc) (ServersItem, bool)

Find finds first matched item from the map.

func (*Servers) Get

func (m *Servers) Get(k string) (*Server, bool)

Get gets a value by key.

func (*Servers) GetValue

func (m *Servers) GetValue(k string) *Server

GetValue gets a value by key.

func (*Servers) Has

func (m *Servers) Has(k string) bool

Has checks that specified key is set.

func (*Servers) Len

func (m *Servers) Len() int

Len returns count of values.

func (*Servers) Map

func (m *Servers) Map(fn mapServersFunc) error

Map iterates and changes values in the map.

func (*Servers) MarshalJSON

func (m *Servers) MarshalJSON() ([]byte, error)

func (*Servers) Set

func (m *Servers) Set(k string, v *Server)

Set sets a value with specified key.

func (*Servers) SetToTop

func (m *Servers) SetToTop(k string, v *Server)

SetToTop do the same as Set, but new key will be placed on top of the order map.

func (*Servers) Update

func (m *Servers) Update(k string, fn func(v *Server) *Server)

Update updates a value with specified key.

type ServersItem

type ServersItem struct {
	Key   string
	Value *Server
}

ServersItem represent single data from the Servers.

type StringSet

type StringSet struct {
	// contains filtered or unexported fields
}

StringSet a set of strings. gen:Set

func NewStringSet

func NewStringSet(vv ...string) *StringSet

func (*StringSet) Add

func (m *StringSet) Add(v string)

Add adds specific value to set.

func (*StringSet) Data

func (m *StringSet) Data() []string

Data return set's data.

func (*StringSet) Has

func (m *StringSet) Has(v string) bool

Has checks that specified value is exists.

func (*StringSet) Len

func (m *StringSet) Len() int

Len returns len of set.

type Tag

type Tag struct {
	InteractionGroups map[Protocol]TagInteractionGroup
	Children          *Tags
	Name              TagName
	Title             string
	Description       *string
}

func NewTag

func NewTag(name, title string) *Tag

func (*Tag) MarshalJSON

func (t *Tag) MarshalJSON() ([]byte, error)

type TagHTTPInteractionGroup

type TagHTTPInteractionGroup struct {
	Protocol     Protocol        `json:"protocol"`
	Interactions []InteractionID `json:"interactions"`
}

type TagInteractionGroup

type TagInteractionGroup interface {
	// contains filtered or unexported methods
}

type TagJsonRpcInteractionGroup

type TagJsonRpcInteractionGroup struct {
	Protocol     Protocol        `json:"protocol"`
	Interactions []InteractionID `json:"interactions"`
}

type TagName

type TagName string

func (TagName) MarshalText

func (t TagName) MarshalText() ([]byte, error)

type Tags

type Tags struct {
	// contains filtered or unexported fields
}

Tags represent available tags. gen:OrderedMap

func (*Tags) Each

func (m *Tags) Each(fn eachTagsFunc) error

Each iterates and perform given function on each item in the map.

func (*Tags) EachReverse

func (m *Tags) EachReverse(fn eachTagsFunc) error

EachReverse act almost the same as Each but in reverse order.

func (*Tags) EachSafe

func (m *Tags) EachSafe(fn eachSafeTagsFunc)

func (*Tags) Find

func (m *Tags) Find(fn findTagsFunc) (TagsItem, bool)

Find finds first matched item from the map.

func (*Tags) Get

func (m *Tags) Get(k TagName) (*Tag, bool)

Get gets a value by key.

func (*Tags) GetValue

func (m *Tags) GetValue(k TagName) *Tag

GetValue gets a value by key.

func (*Tags) Has

func (m *Tags) Has(k TagName) bool

Has checks that specified key is set.

func (*Tags) Len

func (m *Tags) Len() int

Len returns count of values.

func (*Tags) Map

func (m *Tags) Map(fn mapTagsFunc) error

Map iterates and changes values in the map.

func (*Tags) MarshalJSON

func (m *Tags) MarshalJSON() ([]byte, error)

func (*Tags) Set

func (m *Tags) Set(k TagName, v *Tag)

Set sets a value with specified key.

func (*Tags) SetToTop

func (m *Tags) SetToTop(k TagName, v *Tag)

SetToTop do the same as Set, but new key will be placed on top of the order map.

func (*Tags) Update

func (m *Tags) Update(k TagName, fn func(v *Tag) *Tag)

Update updates a value with specified key.

type TagsItem

type TagsItem struct {
	Key   TagName
	Value *Tag
}

TagsItem represent single data from the Tags.

type UserRule

type UserRule struct {
	Annotation  string               `json:"annotation"`
	Description string               `json:"description"`
	Directive   *directive.Directive `json:"-"`
	Value       Rule                 `json:"value"`
}

type UserRules

type UserRules struct {
	// contains filtered or unexported fields
}

UserRules represent available user rules. gen:OrderedMap

func (*UserRules) Each

func (m *UserRules) Each(fn eachUserRulesFunc) error

Each iterates and perform given function on each item in the map.

func (*UserRules) EachReverse

func (m *UserRules) EachReverse(fn eachUserRulesFunc) error

EachReverse act almost the same as Each but in reverse order.

func (*UserRules) EachSafe

func (m *UserRules) EachSafe(fn eachSafeUserRulesFunc)

func (*UserRules) Find

func (m *UserRules) Find(fn findUserRulesFunc) (UserRulesItem, bool)

Find finds first matched item from the map.

func (*UserRules) Get

func (m *UserRules) Get(k string) (*UserRule, bool)

Get gets a value by key.

func (*UserRules) GetValue

func (m *UserRules) GetValue(k string) *UserRule

GetValue gets a value by key.

func (*UserRules) Has

func (m *UserRules) Has(k string) bool

Has checks that specified key is set.

func (*UserRules) Len

func (m *UserRules) Len() int

Len returns count of values.

func (*UserRules) Map

func (m *UserRules) Map(fn mapUserRulesFunc) error

Map iterates and changes values in the map.

func (*UserRules) MarshalJSON

func (m *UserRules) MarshalJSON() ([]byte, error)

func (*UserRules) Set

func (m *UserRules) Set(k string, v *UserRule)

Set sets a value with specified key.

func (*UserRules) SetToTop

func (m *UserRules) SetToTop(k string, v *UserRule)

SetToTop do the same as Set, but new key will be placed on top of the order map.

func (*UserRules) Update

func (m *UserRules) Update(k string, fn func(v *UserRule) *UserRule)

Update updates a value with specified key.

type UserRulesItem

type UserRulesItem struct {
	Key   string
	Value *UserRule
}

UserRulesItem represent single data from the UserRules.

type UserSchemas

type UserSchemas struct {
	// contains filtered or unexported fields
}

UserSchemas represent available user type's schemas. gen:UnsafeOrderedMap

func (*UserSchemas) Each

func (m *UserSchemas) Each(fn eachUserSchemasFunc) error

Each iterates and perform given function on each item in the map.

func (*UserSchemas) EachSafe

func (m *UserSchemas) EachSafe(fn eachSafeUserSchemasFunc)

func (*UserSchemas) Get

func (m *UserSchemas) Get(k string) (schema.Schema, bool)

Get gets a value by key.

func (*UserSchemas) GetValue

func (m *UserSchemas) GetValue(k string) schema.Schema

GetValue gets a value by key.

func (*UserSchemas) Has

func (m *UserSchemas) Has(k string) bool

Has checks that specified key is set.

func (*UserSchemas) Len

func (m *UserSchemas) Len() int

Len returns count of values.

func (*UserSchemas) Map

func (m *UserSchemas) Map(fn mapUserSchemasFunc) error

Map iterates and changes values in the map.

func (*UserSchemas) MarshalJSON

func (m *UserSchemas) MarshalJSON() ([]byte, error)

func (*UserSchemas) Set

func (m *UserSchemas) Set(k string, v schema.Schema)

Set sets a value with specified key.

func (*UserSchemas) Update

func (m *UserSchemas) Update(k string, fn func(v schema.Schema) schema.Schema)

Update updates a value with specified key.

type UserSchemasItem

type UserSchemasItem struct {
	Key   string
	Value schema.Schema
}

UserSchemasItem represent single data from the UserSchemas.

type UserType

type UserType struct {
	Annotation  string              `json:"annotation,omitempty"`
	Description string              `json:"description,omitempty"`
	Schema      ExchangeSchema      `json:"schema"`
	Directive   directive.Directive `json:"-"`
}

type UserTypes

type UserTypes struct {
	// contains filtered or unexported fields
}

UserTypes represent available user types. gen:OrderedMap

func (*UserTypes) Each

func (m *UserTypes) Each(fn eachUserTypesFunc) error

Each iterates and perform given function on each item in the map.

func (*UserTypes) EachReverse

func (m *UserTypes) EachReverse(fn eachUserTypesFunc) error

EachReverse act almost the same as Each but in reverse order.

func (*UserTypes) EachSafe

func (m *UserTypes) EachSafe(fn eachSafeUserTypesFunc)

func (*UserTypes) Find

func (m *UserTypes) Find(fn findUserTypesFunc) (UserTypesItem, bool)

Find finds first matched item from the map.

func (*UserTypes) Get

func (m *UserTypes) Get(k string) (*UserType, bool)

Get gets a value by key.

func (*UserTypes) GetValue

func (m *UserTypes) GetValue(k string) *UserType

GetValue gets a value by key.

func (*UserTypes) Has

func (m *UserTypes) Has(k string) bool

Has checks that specified key is set.

func (*UserTypes) Len

func (m *UserTypes) Len() int

Len returns count of values.

func (*UserTypes) Map

func (m *UserTypes) Map(fn mapUserTypesFunc) error

Map iterates and changes values in the map.

func (*UserTypes) MarshalJSON

func (m *UserTypes) MarshalJSON() ([]byte, error)

func (*UserTypes) Set

func (m *UserTypes) Set(k string, v *UserType)

Set sets a value with specified key.

func (*UserTypes) SetToTop

func (m *UserTypes) SetToTop(k string, v *UserType)

SetToTop do the same as Set, but new key will be placed on top of the order map.

func (*UserTypes) Update

func (m *UserTypes) Update(k string, fn func(v *UserType) *UserType)

Update updates a value with specified key.

type UserTypesItem

type UserTypesItem struct {
	Key   string
	Value *UserType
}

UserTypesItem represent single data from the UserTypes.

Directories

Path Synopsis
ser

Jump to

Keyboard shortcuts

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