Documentation ¶
Index ¶
- Constants
- Variables
- func ErrCollectionNotFound(col string) error
- func ErrDocumentNotFound(doc string) error
- func ErrDomainNotFound(domain string) error
- func ErrModuleNotFound(mod string) error
- func ErrNamespaceNotFound(ns string) error
- func ErrRouteNotFound(route string) error
- func ErrSecretNotFound(secret string) error
- func ErrServiceNotFound(svc string) error
- type Action
- type ChangeLog
- type Collection
- type CollectionType
- type CollectionVisibility
- type Command
- type DGateCollection
- type DGateDocument
- type DGateDomain
- type DGateModule
- type DGateNamespace
- type DGateRoute
- type DGateSecret
- type DGateService
- type Document
- type Domain
- type Module
- type ModuleType
- type Name
- type Named
- type Namespace
- type Resource
- type ResponseWriterTracker
- type Route
- type Secret
- type Service
Constants ¶
View Source
const ( Add Action = "add" Delete Action = "delete" Routes Resource = "route" Services Resource = "service" Namespaces Resource = "namespace" Modules Resource = "module" Domains Resource = "domain" Collections Resource = "collection" Documents Resource = "document" Secrets Resource = "secret" )
Variables ¶
View Source
var DefaultNamespace = &Namespace{ Name: "default", Tags: []string{"default"}, }
Functions ¶
func ErrCollectionNotFound ¶
func ErrDocumentNotFound ¶
func ErrDomainNotFound ¶
func ErrModuleNotFound ¶
func ErrNamespaceNotFound ¶
func ErrRouteNotFound ¶
func ErrSecretNotFound ¶ added in v0.8.0
func ErrServiceNotFound ¶
Types ¶
type ChangeLog ¶
type ChangeLog struct { ID string `json:"id"` Cmd Command `json:"cmd"` Name string `json:"name"` Namespace string `json:"namespace"` Item any `json:"item"` Version int `json:"version"` }
func NewNoopChangeLog ¶ added in v0.10.0
func NewNoopChangeLog() *ChangeLog
type Collection ¶
type Collection struct { Name string `json:"name" koanf:"name"` NamespaceName string `json:"namespace" koanf:"namespace"` Schema any `json:"schema" koanf:"schema"` Visibility CollectionVisibility `json:"visibility" koanf:"visibility"` Type CollectionType `json:"type" koanf:"type"` // Modules []string `json:"modules,omitempty" koanf:"modules"` Tags []string `json:"tags,omitempty" koanf:"tags"` }
func TransformDGateCollection ¶
func TransformDGateCollection(col *DGateCollection) *Collection
func TransformDGateCollections ¶
func TransformDGateCollections(collections ...*DGateCollection) []*Collection
func (*Collection) GetName ¶
func (n *Collection) GetName() string
type CollectionType ¶
type CollectionType string
const ( CollectionTypeDocument CollectionType = "document" CollectionTypeFetcher CollectionType = "fetcher" )
type CollectionVisibility ¶
type CollectionVisibility string
const ( CollectionVisibilityPublic CollectionVisibility = "public" CollectionVisibilityPrivate CollectionVisibility = "private" )
type Command ¶
type Command string
var ( AddRouteCommand Command = newCommand(Add, Routes) AddServiceCommand Command = newCommand(Add, Services) AddNamespaceCommand Command = newCommand(Add, Namespaces) AddModuleCommand Command = newCommand(Add, Modules) AddDomainCommand Command = newCommand(Add, Domains) AddCollectionCommand Command = newCommand(Add, Collections) AddDocumentCommand Command = newCommand(Add, Documents) AddSecretCommand Command = newCommand(Add, Secrets) DeleteRouteCommand Command = newCommand(Delete, Routes) DeleteServiceCommand Command = newCommand(Delete, Services) DeleteNamespaceCommand Command = newCommand(Delete, Namespaces) DeleteModuleCommand Command = newCommand(Delete, Modules) DeleteDomainCommand Command = newCommand(Delete, Domains) DeleteCollectionCommand Command = newCommand(Delete, Collections) DeleteDocumentCommand Command = newCommand(Delete, Documents) DeleteSecretCommand Command = newCommand(Delete, Secrets) // internal commands NoopCommand Command = Command("noop") )
func (Command) IsShutdown ¶ added in v0.8.0
type DGateCollection ¶
type DGateCollection struct { Name string `json:"name"` Namespace *DGateNamespace `json:"namespace"` Schema *jsonschema.Schema `json:"schema"` SchemaPayload string `json:"schema_payload"` Type CollectionType `json:"type"` Visibility CollectionVisibility `json:"visibility"` // Modules []*DGateModule `json:"modules"` Tags []string `json:"tags,omitempty"` }
func TransformCollection ¶
func TransformCollection(ns *DGateNamespace, mods []*DGateModule, col *Collection) *DGateCollection
func TransformCollections ¶
func TransformCollections(ns *DGateNamespace, mods []*DGateModule, collections ...*Collection) []*DGateCollection
func (*DGateCollection) GetName ¶
func (n *DGateCollection) GetName() string
type DGateDocument ¶
type DGateDocument struct { ID string `json:"id"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Namespace *DGateNamespace `json:"namespace"` Collection *DGateCollection `json:"collection"` Data string `json:"data"` }
func TransformDocument ¶
func TransformDocument(ns *DGateNamespace, col *DGateCollection, document *Document) *DGateDocument
func TransformDocuments ¶
func TransformDocuments(ns *DGateNamespace, col *DGateCollection, documents ...*Document) []*DGateDocument
func (*DGateDocument) GetName ¶
func (n *DGateDocument) GetName() string
type DGateDomain ¶
type DGateDomain struct { Name string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Namespace *DGateNamespace `json:"namespace"` Patterns []string `json:"pattern"` Priority int `json:"priority"` Cert string `json:"cert"` Key string `json:"key"` Tags []string `json:"tags,omitempty"` }
func TransformDomain ¶
func TransformDomain(ns *DGateNamespace, dom *Domain) *DGateDomain
func TransformDomains ¶
func TransformDomains(ns *DGateNamespace, domains ...*Domain) []*DGateDomain
type DGateModule ¶
type DGateModule struct { Name string `json:"name"` Namespace *DGateNamespace `json:"namespace"` Payload string `json:"payload"` Type ModuleType `json:"module_type"` Tags []string `json:"tags,omitempty"` }
func TransformModule ¶
func TransformModule(ns *DGateNamespace, m *Module) (*DGateModule, error)
func TransformModules ¶
func TransformModules(ns *DGateNamespace, modules ...*Module) ([]*DGateModule, error)
func (*DGateModule) GetName ¶
func (m *DGateModule) GetName() string
type DGateNamespace ¶
func TransformNamespace ¶
func TransformNamespace(ns *Namespace) *DGateNamespace
func TransformNamespaces ¶
func TransformNamespaces(namespaces ...*Namespace) []*DGateNamespace
func (*DGateNamespace) GetName ¶
func (ns *DGateNamespace) GetName() string
type DGateRoute ¶
type DGateRoute struct { Name string `json:"name"` Paths []string `json:"paths"` Methods []string `json:"methods"` StripPath bool `json:"stripPath"` PreserveHost bool `json:"preserveHost"` Service *DGateService `json:"service"` Namespace *DGateNamespace `json:"namespace"` Modules []*DGateModule `json:"modules"` Tags []string `json:"tags,omitempty"` }
func TransformRoute ¶
func TransformRoute(r Route) *DGateRoute
func TransformRoutes ¶
func TransformRoutes(routes ...Route) []*DGateRoute
func (*DGateRoute) GetName ¶
func (r *DGateRoute) GetName() string
type DGateSecret ¶ added in v0.8.0
type DGateSecret struct { Name string `json:"name"` CreatedAt time.Time `json:"created_at"` UpdatedAt time.Time `json:"updated_at"` Namespace *DGateNamespace `json:"namespace"` Data string `json:"data"` Tags []string `json:"tags,omitempty"` }
func TransformSecret ¶ added in v0.8.0
func TransformSecret(ns *DGateNamespace, secret *Secret) (*DGateSecret, error)
func TransformSecrets ¶ added in v0.8.0
func TransformSecrets(ns *DGateNamespace, secrets ...*Secret) ([]*DGateSecret, error)
func (*DGateSecret) GetName ¶ added in v0.8.0
func (n *DGateSecret) GetName() string
type DGateService ¶
type DGateService struct { Name string `json:"name"` URLs []*url.URL `json:"urls"` Tags []string `json:"tags,omitempty"` Namespace *DGateNamespace `json:"namespace"` DisableQueryParams bool `json:"disableQueryParams,omitempty"` Retries int `json:"retries,omitempty"` RetryTimeout time.Duration `json:"retryTimeout,omitempty"` ConnectTimeout time.Duration `json:"connectTimeout,omitempty"` RequestTimeout time.Duration `json:"requestTimeout,omitempty"` TLSSkipVerify bool `json:"tlsSkipVerify,omitempty"` HTTP2Only bool `json:"http2_only,omitempty"` HideDGateHeaders bool `json:"hideDGateHeaders,omitempty"` }
func TransformService ¶
func TransformService(ns *DGateNamespace, s *Service) *DGateService
func TransformServices ¶
func TransformServices(ns *DGateNamespace, services ...*Service) []*DGateService
func (*DGateService) GetName ¶
func (s *DGateService) GetName() string
type Document ¶
type Document struct { ID string `json:"id"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` NamespaceName string `json:"namespace"` CollectionName string `json:"collection"` Data any `json:"data"` }
func TransformDGateDocument ¶
func TransformDGateDocument(document *DGateDocument) *Document
func TransformDGateDocuments ¶
func TransformDGateDocuments(documents ...*DGateDocument) []*Document
type Domain ¶
type Domain struct { Name string `json:"name" koanf:"name"` NamespaceName string `json:"namespace" koanf:"namespace"` Patterns []string `json:"patterns" koanf:"patterns"` Priority int `json:"priority" koanf:"priority"` Cert string `json:"cert" koanf:"cert"` Key string `json:"key" koanf:"key"` Tags []string `json:"tags,omitempty" koanf:"tags"` }
func TransformDGateDomain ¶
func TransformDGateDomain(dom *DGateDomain) *Domain
func TransformDGateDomains ¶
func TransformDGateDomains(domains ...*DGateDomain) []*Domain
type Module ¶
type Module struct { Name string `json:"name" koanf:"name"` NamespaceName string `json:"namespace" koanf:"namespace"` Payload string `json:"payload" koanf:"payload"` Type ModuleType `json:"moduleType,omitempty" koanf:"moduleType"` Tags []string `json:"tags,omitempty" koanf:"tags"` }
func TransformDGateModule ¶
func TransformDGateModule(m *DGateModule) *Module
func TransformDGateModules ¶
func TransformDGateModules(modules ...*DGateModule) []*Module
type ModuleType ¶
type ModuleType string
const ( ModuleTypeJavascript ModuleType = "javascript" ModuleTypeTypescript ModuleType = "typescript" )
func (ModuleType) String ¶
func (m ModuleType) String() string
func (ModuleType) Valid ¶
func (m ModuleType) Valid() bool
type Namespace ¶
type Namespace struct { Name string `json:"name" koanf:"name"` Tags []string `json:"tags,omitempty" koanf:"tags"` }
func TransformDGateNamespace ¶
func TransformDGateNamespace(ns *DGateNamespace) *Namespace
func TransformDGateNamespaces ¶
func TransformDGateNamespaces(namespaces ...*DGateNamespace) []*Namespace
type ResponseWriterTracker ¶
type ResponseWriterTracker interface { http.ResponseWriter Status() int HeadersSent() bool BytesWritten() int64 }
func NewResponseWriterTracker ¶
func NewResponseWriterTracker(rw http.ResponseWriter) ResponseWriterTracker
type Route ¶
type Route struct { Name string `json:"name" koanf:"name"` Paths []string `json:"paths" koanf:"paths"` Methods []string `json:"methods" koanf:"methods"` PreserveHost bool `json:"preserveHost" koanf:"preserveHost"` StripPath bool `json:"stripPath" koanf:"stripPath"` ServiceName string `json:"service,omitempty" koanf:"service"` NamespaceName string `json:"namespace" koanf:"namespace"` Modules []string `json:"modules,omitempty" koanf:"modules"` Tags []string `json:"tags,omitempty" koanf:"tags"` }
func TransformDGateRoute ¶
func TransformDGateRoute(r *DGateRoute) *Route
func TransformDGateRoutes ¶
func TransformDGateRoutes(routes ...*DGateRoute) []*Route
type Secret ¶ added in v0.8.0
type Secret struct { Name string `json:"name"` NamespaceName string `json:"namespace"` Data string `json:"data,omitempty"` Tags []string `json:"tags,omitempty"` }
func TransformDGateSecret ¶ added in v0.8.0
func TransformDGateSecret(sec *DGateSecret) *Secret
func TransformDGateSecrets ¶ added in v0.8.0
func TransformDGateSecrets(secrets ...*DGateSecret) []*Secret
type Service ¶
type Service struct { Name string `json:"name" koanf:"name"` URLs []string `json:"urls" koanf:"urls"` NamespaceName string `json:"namespace" koanf:"namespace"` Retries *int `json:"retries,omitempty" koanf:"retries"` RetryTimeout *time.Duration `json:"retryTimeout,omitempty" koanf:"retryTimeout"` ConnectTimeout *time.Duration `json:"connectTimeout,omitempty" koanf:"connectTimeout"` RequestTimeout *time.Duration `json:"requestTimeout,omitempty" koanf:"requestTimeout"` TLSSkipVerify *bool `json:"tlsSkipVerify,omitempty" koanf:"tlsSkipVerify"` HTTP2Only *bool `json:"http2Only,omitempty" koanf:"http2Only"` HideDGateHeaders *bool `json:"hideDGateHeaders,omitempty" koanf:"hideDGateHeaders"` DisableQueryParams *bool `json:"disableQueryParams,omitempty" koanf:"disableQueryParams"` Tags []string `json:"tags,omitempty" koanf:"tags"` }
func TransformDGateService ¶
func TransformDGateService(s *DGateService) *Service
func TransformDGateServices ¶
func TransformDGateServices(services ...*DGateService) []*Service
Click to show internal directories.
Click to hide internal directories.