Documentation ¶
Index ¶
- Variables
- type Database
- type MappingsReader
- type MappingsWriter
- type QueryReader
- func (qr QueryReader) Get(ctx context.Context, namespace, id string, revision int) (restql.SavedQuery, error)
- func (qr QueryReader) ListNamespaces(ctx context.Context) ([]string, error)
- func (qr QueryReader) ListQueriesForNamespace(ctx context.Context, namespace string) (map[string][]restql.SavedQuery, error)
- func (qr QueryReader) ListQueryRevisions(ctx context.Context, namespace string, queryName string) ([]restql.SavedQuery, error)
- type QueryWriter
Constants ¶
This section is empty.
Variables ¶
var ErrCreateRevisionNotAllowed = errors.New("a local query cannot be updated with a new revision : remove it from the local configuration or migrate it to the database")
ErrCreateRevisionNotAllowed is returned when trying to write a query revision on a query stored on local or env.
var ErrSetResourceMappingNotAllowed = errors.New("a resource mapping must have a source of type database in order to provide writing operations")
ErrSetResourceMappingNotAllowed is returned when trying to write a resource mapping on a resource stored on local or env.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database restql.DatabasePlugin
Database defines the operations exposed by an external store.
type MappingsReader ¶
type MappingsReader struct {
// contains filtered or unexported fields
}
MappingsReader fetch indexed mappings from database, configuration file and environment variable.
func NewMappingReader ¶
func NewMappingReader(log restql.Logger, env domain.EnvSource, local map[string]string, localByTenant map[string]map[string]string, db Database) MappingsReader
NewMappingReader constructs a MappingsReader instance.
func (MappingsReader) FromTenant ¶
func (mr MappingsReader) FromTenant(ctx context.Context, tenant string) (map[string]restql.Mapping, error)
FromTenant fetch the mappings for the given tenant.
func (MappingsReader) ListTenants ¶ added in v4.4.0
func (mr MappingsReader) ListTenants(ctx context.Context) ([]string, error)
ListTenants fetch all tenants under which mappings are organized
type MappingsWriter ¶ added in v4.4.0
type MappingsWriter struct {
// contains filtered or unexported fields
}
MappingsWriter is the entity that maps resource name to URL.
type QueryReader ¶
type QueryReader struct {
// contains filtered or unexported fields
}
A QueryReader get a query from local configuration file or a database instance.
func NewQueryReader ¶
func NewQueryReader(log restql.Logger, local map[string]map[string][]string, db Database) QueryReader
NewQueryReader constructs a QueryReader from the given configuration and database.
func (QueryReader) Get ¶
func (qr QueryReader) Get(ctx context.Context, namespace, id string, revision int) (restql.SavedQuery, error)
Get retrieves a query by its identity (namespace, id and revision), it first search the database and, if not found, in the configuration file.
func (QueryReader) ListNamespaces ¶ added in v4.4.0
func (qr QueryReader) ListNamespaces(ctx context.Context) ([]string, error)
ListNamespaces fetches all namespace on config, env and database
func (QueryReader) ListQueriesForNamespace ¶ added in v4.4.0
func (qr QueryReader) ListQueriesForNamespace(ctx context.Context, namespace string) (map[string][]restql.SavedQuery, error)
ListQueriesForNamespace fetches the queries under the given namespace, stored on config file, env or database.
func (QueryReader) ListQueryRevisions ¶ added in v4.4.0
func (qr QueryReader) ListQueryRevisions(ctx context.Context, namespace string, queryName string) ([]restql.SavedQuery, error)
ListQueryRevisions fetch revisions for a query on the given namespace, stored on the config file, env or database.
type QueryWriter ¶ added in v4.4.0
type QueryWriter struct {
// contains filtered or unexported fields
}
QueryWriter is the entity that create a new query revision when it is stored on the database.
func NewQueryWriter ¶ added in v4.4.0
func NewQueryWriter(log restql.Logger, local map[string]map[string][]string, db Database) QueryWriter
NewQueryWriter creates a QueryWriter instance