providers

package
v0.1.18 Latest Latest
Warning

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

Go to latest
Published: Jan 28, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Index

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 PersonalInfo struct {
	Name string
	Sex  string
}

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

func (r *Request) GetRequestedFields() []string

GetRequestedFields returns the fields that the request wants filled in the response.

Jump to

Keyboard shortcuts

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