Documentation
¶
Index ¶
- func NewCPFIndexer(indexerDB []string) queryplanner.IndexProvider
- func NewCovidDatabaseProvider(repo map[string]bool) queryplanner.FieldProvider
- func NewGovDatabaseProvider(repo map[string]PersonalInfo) queryplanner.FieldProvider
- type CPFFormatterProvider
- type CPFIndexer
- type CovidDatabaseProvider
- type GovDatabaseProvider
- type GovProviderKey
- type Person
- type PersonalInfo
- type Request
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCPFIndexer ¶
func NewCPFIndexer(indexerDB []string) queryplanner.IndexProvider
NewCovidDatabaseProvider You can use a constructor to pass in the dependencies to your provider, such as database connections.
func NewCovidDatabaseProvider ¶
func NewCovidDatabaseProvider(repo map[string]bool) queryplanner.FieldProvider
NewCovidDatabaseProvider You can use a constructor to pass in the dependencies to your provider, such as database connections.
func NewGovDatabaseProvider ¶
func NewGovDatabaseProvider(repo map[string]PersonalInfo) queryplanner.FieldProvider
Types ¶
type CPFFormatterProvider ¶
type CPFFormatterProvider struct{}
func (*CPFFormatterProvider) DependsOn ¶
func (p *CPFFormatterProvider) DependsOn() []queryplanner.FieldName
DependsOn informs the library which information is needed before the provider can be executed. The names must match the ones defined in other providers.
func (*CPFFormatterProvider) Provides ¶
func (p *CPFFormatterProvider) Provides() []queryplanner.Field
Provides return an []queryplanner.Field. Each field has the function to calculate itself and populate the entries with the information.
type CPFIndexer ¶
type CPFIndexer struct {
// contains filtered or unexported fields
}
An indexer is a special type of provider. It must initialize the documents that will be enriched, being the first query to be made.
func (*CPFIndexer) Execute ¶
func (p *CPFIndexer) Execute(ctx context.Context, request queryplanner.Request, fields []string) (*queryplanner.Payload, error)
Execute is the first function to be executed in a query plan. It will return the fields that will pass through each step to the enrichment process. The request param can be a struct that might carry needed information for your service, such as pagination, filters, etc.
func (*CPFIndexer) Provides ¶
func (p *CPFIndexer) Provides() []queryplanner.Index
Provides return an []queryplanner.Index. The index field only has the clear method, since it will be populated in the Execute function of the IndexProvider
type CovidDatabaseProvider ¶
type CovidDatabaseProvider struct {
// contains filtered or unexported fields
}
func (*CovidDatabaseProvider) DependsOn ¶
func (p *CovidDatabaseProvider) DependsOn() []queryplanner.FieldName
DependsOn informs the library which information is needed before the provider can be executed. The names must match the ones defined in other providers.
func (*CovidDatabaseProvider) Provides ¶
func (p *CovidDatabaseProvider) Provides() []queryplanner.Field
Provides return an []queryplanner.Field. Each field has the function to calculate itself and populate the entries with the information.
type GovDatabaseProvider ¶
type GovDatabaseProvider struct {
// contains filtered or unexported fields
}
func (*GovDatabaseProvider) DependsOn ¶
func (p *GovDatabaseProvider) DependsOn() []queryplanner.FieldName
DependsOn informs the library which information is needed before the provider can be executed. The names must match the ones defined in other providers.
func (*GovDatabaseProvider) Provides ¶
func (p *GovDatabaseProvider) Provides() []queryplanner.Field
Provides return an []queryplanner.Field. Each field has the function to calculate itself and populate the entries with the information.
type GovProviderKey ¶
type GovProviderKey string
type Person ¶
type Person struct {
CPF *string // CPF is an identifier that we will retrieve from the index provider
Name *string // Name is retrieved from the government database
HadCovid *bool // HasCovid is retrieved from the covid database
Sex *string
}
Person describes the document that we want retrieve with our query.
type PersonalInfo ¶
type Request ¶
type Request struct {
Limit int // custom field that represents the max quantity of documents that will be returned in the request.
Fields []string
}
Request represents the request struct that will be passed to the queryPlanner. It should contain a method that returns the fields that the user wants filled in their request. The request might still contain information needed for your query execution like pagination, filters, etc.
func (*Request) GetRequestedFields ¶
GetRequestedFields returns the fields that the request wants filled in the response.