Documentation ¶
Index ¶
- func New(config interface{}) (error, dbconnector.DatabaseConnector)
- type Config
- type Foobar
- func (f *Foobar) AddAction(ctx context.Context, action *models.Action, UUID strfmt.UUID) error
- func (f *Foobar) AddActionsBatch(ctx context.Context, actions batchmodels.Actions) error
- func (f *Foobar) AddClass(ctx context.Context, kind kind.Kind, class *models.SemanticSchemaClass) error
- func (f *Foobar) AddProperty(ctx context.Context, kind kind.Kind, className string, ...) error
- func (f *Foobar) AddThing(ctx context.Context, thing *models.Thing, UUID strfmt.UUID) error
- func (f *Foobar) AddThingsBatch(ctx context.Context, things batchmodels.Things) error
- func (f *Foobar) Attach(ctx context.Context) (context.Context, error)
- func (f *Foobar) Connect() error
- func (f *Foobar) DeleteAction(ctx context.Context, action *models.Action, UUID strfmt.UUID) error
- func (f *Foobar) DeleteThing(ctx context.Context, thing *models.Thing, UUID strfmt.UUID) error
- func (f *Foobar) DropClass(ctx context.Context, kind kind.Kind, className string) error
- func (f *Foobar) DropProperty(ctx context.Context, kind kind.Kind, className string, propName string) error
- func (f *Foobar) GetAction(ctx context.Context, UUID strfmt.UUID, ...) error
- func (f *Foobar) GetActions(ctx context.Context, UUIDs []strfmt.UUID, ...) error
- func (f *Foobar) GetThing(ctx context.Context, UUID strfmt.UUID, thingResponse *models.ThingGetResponse) error
- func (f *Foobar) GetThings(ctx context.Context, UUIDs []strfmt.UUID, ...) error
- func (f *Foobar) HistoryAction(ctx context.Context, UUID strfmt.UUID, history *models.ActionHistory) error
- func (f *Foobar) HistoryThing(ctx context.Context, UUID strfmt.UUID, history *models.ThingHistory) error
- func (f *Foobar) Init(ctx context.Context) error
- func (f *Foobar) ListActions(ctx context.Context, first int, offset int, wheres []*connutils.WhereQuery, ...) error
- func (f *Foobar) ListThings(ctx context.Context, first int, offset int, wheres []*connutils.WhereQuery, ...) error
- func (f *Foobar) LocalAggregate(info *aggregate.Params) (interface{}, error)
- func (f *Foobar) LocalFetchKindClass(info *fetch.Params) (interface{}, error)
- func (f *Foobar) LocalGetClass(info *get.Params) (interface{}, error)
- func (f *Foobar) LocalGetMeta(info *getmeta.Params) (interface{}, error)
- func (f *Foobar) MoveToHistoryAction(ctx context.Context, action *models.Action, UUID strfmt.UUID, deleted bool) error
- func (f *Foobar) MoveToHistoryThing(ctx context.Context, thing *models.Thing, UUID strfmt.UUID, deleted bool) error
- func (f *Foobar) SetMessaging(m *messages.Messaging)
- func (f *Foobar) SetSchema(schemaInput schema.Schema)
- func (f *Foobar) SetServerAddress(addr string)
- func (f *Foobar) SetState(ctx context.Context, state json.RawMessage)
- func (f *Foobar) SetStateManager(manager connector_state.StateManager)
- func (f *Foobar) UpdateAction(ctx context.Context, action *models.Action, UUID strfmt.UUID) error
- func (f *Foobar) UpdateClass(ctx context.Context, kind kind.Kind, className string, newClassName *string, ...) error
- func (f *Foobar) UpdateProperty(ctx context.Context, kind kind.Kind, className string, propName string, ...) error
- func (j *Foobar) UpdatePropertyAddDataType(ctx context.Context, kind kind.Kind, className string, propName string, ...) error
- func (f *Foobar) UpdateThing(ctx context.Context, thing *models.Thing, UUID strfmt.UUID) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(config interface{}) (error, dbconnector.DatabaseConnector)
Types ¶
type Config ¶
Config represents the config outline for Foobar. The Database config shoud be of the following form:
"database_config" : { "host": "127.0.0.1", "port": 9080 }
Notice that the port is the GRPC-port.
type Foobar ¶
type Foobar struct {
// contains filtered or unexported fields
}
Foobar has some basic variables. This is mandatory, only change it if you need aditional, global variables
func (*Foobar) AddAction ¶
AddAction adds an action to the Foobar database with the given UUID. Takes the action and a UUID as input. Action is already validated against the ontology
func (*Foobar) AddActionsBatch ¶
AddActionsBatch can be used for imports of large datasets. There is no fixed batch size, each connector can decide for themselves to split up the incoming batch into smaller chunks. For example the Janusgraph connector makes this cut at 50 items as this has proven to be a good threshold for that particular connector.
Note that every action in the batchmodels.Actions list also has an error field. The connector must check whether there already is an error in one of the items. This error could for example indicate a failed validation. Items that have failed prior to making it to the connector are not removed on purpose, so that the return result to the user matches their original request in both length and order.
The connector can decide - based on the batching consistency promises it makes to the user - whether to fail (and not import) the entire batch or only to skip the ones which failed validation
func (*Foobar) AddClass ¶
func (f *Foobar) AddClass(ctx context.Context, kind kind.Kind, class *models.SemanticSchemaClass) error
Add a class to the Thing or Action schema, depending on the kind parameter.
func (*Foobar) AddProperty ¶
func (*Foobar) AddThing ¶
AddThing adds a thing to the Foobar database with the given UUID. Takes the thing and a UUID as input. Thing is already validated against the ontology
func (*Foobar) AddThingsBatch ¶
AddThingsBatch can be used for imports of large datasets. There is no fixed batch size, each connector can decide for themselves to split up the incoming batch into smaller chunks. For example the Janusgraph connector makes this cut at 50 items as this has proven to be a good threshold for that particular connector.
Note that every thing in the batchmodels.Things list also has an error field. The connector must check whether there already is an error in one of the items. This error could for example indicate a failed validation. Items that have failed prior to making it to the connector are not removed on purpose, so that the return result to the user matches their original request in both length and order.
The connector can decide - based on the batching consistency promises it makes to the user - whether to fail (and not import) the entire batch or only to skip the ones which failed validation
func (*Foobar) Connect ¶
Connect creates a connection to the database and tables if not already available. The connections could not be closed because it is used more often.
func (*Foobar) DeleteAction ¶
DeleteAction deletes the Action in the DB at the given UUID.
func (*Foobar) DeleteThing ¶
DeleteThing deletes the Thing in the DB at the given UUID.
func (*Foobar) DropProperty ¶
func (*Foobar) GetAction ¶
func (f *Foobar) GetAction(ctx context.Context, UUID strfmt.UUID, actionResponse *models.ActionGetResponse) error
GetAction fills the given ActionGetResponse with the values from the database, based on the given UUID.
func (*Foobar) GetActions ¶
func (f *Foobar) GetActions(ctx context.Context, UUIDs []strfmt.UUID, actionsResponse *models.ActionsListResponse) error
GetActions fills the given ActionsListResponse with the values from the database, based on the given UUIDs.
func (*Foobar) GetThing ¶
func (f *Foobar) GetThing(ctx context.Context, UUID strfmt.UUID, thingResponse *models.ThingGetResponse) error
GetThing fills the given ThingGetResponse with the values from the database, based on the given UUID.
func (*Foobar) GetThings ¶
func (f *Foobar) GetThings(ctx context.Context, UUIDs []strfmt.UUID, thingResponse *models.ThingsListResponse) error
GetThings fills the given ThingsListResponse with the values from the database, based on the given UUIDs.
func (*Foobar) HistoryAction ¶
func (f *Foobar) HistoryAction(ctx context.Context, UUID strfmt.UUID, history *models.ActionHistory) error
HistoryAction fills the history of a Action based on its UUID
func (*Foobar) HistoryThing ¶
func (f *Foobar) HistoryThing(ctx context.Context, UUID strfmt.UUID, history *models.ThingHistory) error
HistoryThing fills the history of a thing based on its UUID
func (*Foobar) ListActions ¶
func (f *Foobar) ListActions(ctx context.Context, first int, offset int, wheres []*connutils.WhereQuery, actionsResponse *models.ActionsListResponse) error
ListActions fills the ActionReponse with a list of all actions
func (*Foobar) ListThings ¶
func (f *Foobar) ListThings(ctx context.Context, first int, offset int, wheres []*connutils.WhereQuery, thingsResponse *models.ThingsListResponse) error
ListThings fills the given ThingsListResponse with the values from the database, based on the given parameters.
func (*Foobar) LocalAggregate ¶
LocalAggregate resolves a GraphQL request to aggregate info about a single Class grouped by a property like so:
`{ Local { Aggregate { Things { City(groupBy: ["isCapital"]) { population { mean } } } } } }`
Where "City" is the particular className of kind "Thing". In the example above the user asked to resolve one property named "population". On this particular property the aggregation info "mean" is requested. In addition the "City" class is grouped by the "isCapital" property. So overall the user wants to known what is the mean population of cities which are capitals and what is the mean population of cities which are not capitals? This information is contained in the Params, together with pagination and filter information. Based on this info, the foobar connector can resolve the request. It should resolve to a []map[string]interface{} that can be consumed by the respective resolver in graphqlapi/local/aggregate
An example for a return value matching the above query could look like:
[]interface{}{ map[string]interface{}{ "population": map[string]interface{}{ "mean": 1.2e+06, }, "groupedBy": map[string]interface{}{ "value": "false", "path": []interface{}{ "isCapital", }, }, }, map[string]interface{}{ "population": map[string]interface{}{ "mean": 2.635e+06, }, "groupedBy": map[string]interface{}{ "value": "true", "path": []interface{}{ "isCapital", }, }, }, }
func (*Foobar) LocalFetchKindClass ¶
LocalFetchKindClass TODO: Add proper docs
func (*Foobar) LocalGetClass ¶
LocalGetClass resolves a GraphQL request about a single Class like so
`{ Local { Get { Things { City { population } } } } }`
Where "City" is the particular className of kind "Thing". In the example above the user asked to resolve one property named "population". This information is contained in the Params, together with pagination and filter information. Based on this info, the foobar connector can resolve the request. It should resolve to a []map[string]interface{} that can be consumed by the respective resolver in graphqlapi/local/get.
An example matching the return value to the query above could look like:
[]interface{}{ map[string]interface {}{ "population": 1800000, }, map[string]interface {}{ "population": 600000, }, }
func (*Foobar) LocalGetMeta ¶
LocalGetMeta resolves a GraphQL request to retrieve meta info about a single Class like so:
`{ Local { GetMeta { Things { City { population { count } } } } } }`
Where "City" is the particular className of kind "Thing". In the example above the user asked to resolve one property named "population". On this particular property the meta info "count" is requested, i.e. how many "City" classes have the property "count" set? This information is contained in the Params, together with pagination and filter information. Based on this info, the foobar connector can resolve the request. It should resolve to a map[string]interface{} that can be consumed by the respective resolver in graphqlapi/local/getmeta.
An example for a return value matching the above query could look like:
map[string]interface{}{ "population": map[string]interface{}{ "count": 4, }, }
func (*Foobar) MoveToHistoryAction ¶
func (f *Foobar) MoveToHistoryAction(ctx context.Context, action *models.Action, UUID strfmt.UUID, deleted bool) error
MoveToHistoryAction moves an action to history
func (*Foobar) MoveToHistoryThing ¶
func (f *Foobar) MoveToHistoryThing(ctx context.Context, thing *models.Thing, UUID strfmt.UUID, deleted bool) error
MoveToHistoryThing moves a thing to history
func (*Foobar) SetMessaging ¶
SetMessaging is used to send messages to the service Available message types are: f.messaging.Infomessage ...DebugMessage ...ErrorMessage ...ExitError (also exits the service) ...InfoMessage
func (*Foobar) SetSchema ¶
SetSchema takes actionSchema and thingsSchema as an input and makes them available globally at f.schema
func (*Foobar) SetServerAddress ¶
SetServerAddress is used to fill in a global variable with the server address, but can also be used to do some custom actions. Does not return anything
func (*Foobar) SetState ¶
func (f *Foobar) SetState(ctx context.Context, state json.RawMessage)
SetState is called by a connector when it has updated it's internal state that needs to be shared across all connectors in other Weaviate instances.
func (*Foobar) SetStateManager ¶
func (f *Foobar) SetStateManager(manager connector_state.StateManager)
SetStateManager links a connector to this state manager. When the internal state of some connector is updated, this state connector will call SetState on the provided conn.
func (*Foobar) UpdateAction ¶
UpdateAction updates the Thing in the DB at the given UUID.