Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Database ¶
type Database interface { FindMappingsForTenant(ctx context.Context, tenantID string) ([]restql.Mapping, error) FindQuery(ctx context.Context, namespace string, name string, revision int) (restql.SavedQuery, error) }
Database defines the operations needed to fetch mappings and query from 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, 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.
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.
Click to show internal directories.
Click to hide internal directories.