Documentation
¶
Overview ¶
Package rankedb provides a worker-friendly wrapper around the generated RankeDB API client.
Index ¶
- func Ptr(s string) *string
- func PtrF(f float64) *float64
- type Client
- func (c *Client) CreateNode(ctx context.Context, req CreateNodeRequest) (*apiclient.NodeResponse, error)
- func (c *Client) CreateRun(ctx context.Context, workerConfigID string) (string, error)
- func (c *Client) EnsureWorkerConfig(ctx context.Context, cfg WorkerConfig) (string, error)
- func (c *Client) GetNode(ctx context.Context, id string) (*apiclient.NodeResponse, error)
- func (c *Client) StartRun(ctx context.Context, cfg WorkerConfig) (configID string, runID string, err error)
- type CreateNodeRequest
- type EdgeSpec
- type WorkerConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps the generated API client with worker convenience methods.
func (*Client) CreateNode ¶
func (c *Client) CreateNode(ctx context.Context, req CreateNodeRequest) (*apiclient.NodeResponse, error)
CreateNode creates a node with edges in a single atomic transaction. This uses a manual POST because the generated client doesn't support a request body for this endpoint (it's a RawRoute in schemaf).
func (*Client) EnsureWorkerConfig ¶
EnsureWorkerConfig creates a worker/config node if it doesn't already exist, and returns its node ID. Idempotent by content hash.
type CreateNodeRequest ¶
type CreateNodeRequest struct {
Level int `json:"level"`
ContentClass string `json:"content_class"`
ContentType string `json:"content_type"`
EncodingClass string `json:"encoding_class"`
EncodingFormat string `json:"encoding_format"`
Content *string `json:"content,omitempty"`
ArtifactCreatedAt *string `json:"artifact_created_at,omitempty"`
ArtifactCreatedAtBlur *string `json:"artifact_created_at_blur,omitempty"`
Origin *string `json:"origin,omitempty"`
OriginalName *string `json:"original_name,omitempty"`
ValidFrom *string `json:"valid_from,omitempty"`
ValidFromBlur *string `json:"valid_from_blur,omitempty"`
ValidUntil *string `json:"valid_until,omitempty"`
ValidUntilBlur *string `json:"valid_until_blur,omitempty"`
Confidence *float64 `json:"confidence,omitempty"`
Edges []EdgeSpec `json:"edges,omitempty"`
}
CreateNodeRequest is the JSON body for POST /api/nodes. This is defined here because the generated client doesn't include a request body type for the RawRoute endpoint.
type EdgeSpec ¶
type EdgeSpec struct {
SourceNodeID string `json:"source_node_id,omitempty"`
TargetNodeID string `json:"target_node_id,omitempty"`
Type string `json:"type"`
Confidence *float64 `json:"confidence,omitempty"`
RunID *string `json:"run_id,omitempty"`
}
EdgeSpec defines an edge to create alongside a node.