Documentation
¶
Overview ¶
Package models provides GraphQL model types for NornicDB.
These types are used to serialize/deserialize GraphQL requests and responses. They map to NornicDB's internal storage types and search types.
Index ¶
- func MarshalDateTime(t time.Time, w io.Writer)
- func UnmarshalDateTime(v interface{}) (time.Time, error)
- type BulkCreateNodesInput
- type BulkCreateRelationshipsInput
- type BulkCreateResult
- type BulkDeleteResult
- type CreateNodeInput
- type CreateRelationshipInput
- type CypherInput
- type CypherResult
- type CypherStats
- type DatabaseStats
- type DecayResult
- type EmbeddingStatus
- type FloatArray
- type GraphSchema
- type JSON
- type LabelStats
- type Mutation
- type Node
- type Query
- type Relationship
- type RelationshipDirection
- type RelationshipTypeStats
- type SchemaConstraint
- type SearchMethod
- type SearchOptions
- type SearchResponse
- type SearchResult
- type SearchSortBy
- type SimilarNode
- type SortOrder
- type Subgraph
- type Subscription
- type UpdateNodeInput
- type UpdateRelationshipInput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MarshalDateTime ¶
MarshalDateTime marshals time.Time to RFC3339 string.
func UnmarshalDateTime ¶
UnmarshalDateTime unmarshals GraphQL DateTime scalar to time.Time.
Types ¶
type BulkCreateNodesInput ¶
type BulkCreateNodesInput struct {
Nodes []*CreateNodeInput `json:"nodes"`
SkipDuplicates *bool `json:"skipDuplicates,omitempty"`
}
BulkCreateNodesInput represents input for bulk node creation.
type BulkCreateRelationshipsInput ¶
type BulkCreateRelationshipsInput struct {
Relationships []*CreateRelationshipInput `json:"relationships"`
SkipInvalid *bool `json:"skipInvalid,omitempty"`
}
BulkCreateRelationshipsInput represents input for bulk relationship creation.
type BulkCreateResult ¶
type BulkCreateResult struct {
Created int `json:"created"`
Skipped int `json:"skipped"`
Errors []string `json:"errors"`
}
BulkCreateResult represents bulk creation results.
type BulkDeleteResult ¶
BulkDeleteResult represents bulk deletion results.
type CreateNodeInput ¶
type CreateNodeInput struct {
ID *string `json:"id,omitempty"`
Labels []string `json:"labels"`
Properties JSON `json:"properties"`
Embedding FloatArray `json:"embedding,omitempty"`
}
CreateNodeInput represents input for creating a node.
type CreateRelationshipInput ¶
type CreateRelationshipInput struct {
ID *string `json:"id,omitempty"`
StartNodeID string `json:"startNodeId"`
EndNodeID string `json:"endNodeId"`
Type string `json:"type"`
Properties JSON `json:"properties,omitempty"`
}
CreateRelationshipInput represents input for creating a relationship.
type CypherInput ¶
type CypherInput struct {
Statement string `json:"statement"`
Parameters JSON `json:"parameters,omitempty"`
TimeoutMs *int `json:"timeoutMs,omitempty"`
Database *string `json:"database,omitempty"`
}
CypherInput represents input for Cypher execution.
type CypherResult ¶
type CypherResult struct {
Columns []string `json:"columns"`
Rows [][]interface{} `json:"rows"`
RowCount int `json:"rowCount"`
Stats *CypherStats `json:"stats,omitempty"`
ExecutionTimeMs float64 `json:"executionTimeMs"`
}
CypherResult represents Cypher query results.
type CypherStats ¶
type CypherStats struct {
NodesCreated int `json:"nodesCreated"`
NodesDeleted int `json:"nodesDeleted"`
RelationshipsCreated int `json:"relationshipsCreated"`
RelationshipsDeleted int `json:"relationshipsDeleted"`
PropertiesSet int `json:"propertiesSet"`
LabelsAdded int `json:"labelsAdded"`
LabelsRemoved int `json:"labelsRemoved"`
ContainsUpdates bool `json:"containsUpdates"`
}
CypherStats represents query execution statistics.
type DatabaseStats ¶
type DatabaseStats struct {
NodeCount int `json:"nodeCount"`
RelationshipCount int `json:"relationshipCount"`
Labels []*LabelStats `json:"labels"`
RelationshipTypes []*RelationshipTypeStats `json:"relationshipTypes"`
EmbeddedNodeCount int `json:"embeddedNodeCount"`
UptimeSeconds float64 `json:"uptimeSeconds"`
MemoryUsageBytes int `json:"memoryUsageBytes"`
}
DatabaseStats represents database statistics.
type DecayResult ¶
type DecayResult struct {
NodesProcessed int `json:"nodesProcessed"`
NodesDecayed int `json:"nodesDecayed"`
AverageDecayScore float64 `json:"averageDecayScore"`
}
DecayResult represents decay simulation results.
type EmbeddingStatus ¶
type EmbeddingStatus struct {
Pending int `json:"pending"`
Embedded int `json:"embedded"`
Total int `json:"total"`
WorkerRunning bool `json:"workerRunning"`
}
EmbeddingStatus represents embedding worker status.
type FloatArray ¶
type FloatArray []float32
FloatArray represents a slice of float32 values (for embeddings).
func (FloatArray) MarshalGQL ¶
func (f FloatArray) MarshalGQL(w io.Writer)
MarshalGQL implements the graphql.Marshaler interface.
func (*FloatArray) UnmarshalGQL ¶
func (f *FloatArray) UnmarshalGQL(v interface{}) error
UnmarshalGQL implements the graphql.Unmarshaler interface.
type GraphSchema ¶
type GraphSchema struct {
NodeLabels []string `json:"nodeLabels"`
RelationshipTypes []string `json:"relationshipTypes"`
NodePropertyKeys []string `json:"nodePropertyKeys"`
RelationshipPropertyKeys []string `json:"relationshipPropertyKeys"`
Constraints []*SchemaConstraint `json:"constraints"`
}
GraphSchema represents schema information.
type JSON ¶
type JSON map[string]interface{}
JSON represents arbitrary JSON data.
func (JSON) MarshalGQL ¶
MarshalGQL implements the graphql.Marshaler interface.
func (*JSON) UnmarshalGQL ¶
UnmarshalGQL implements the graphql.Unmarshaler interface.
type LabelStats ¶
LabelStats represents statistics for a label.
type Node ¶
type Node struct {
ID string `json:"id"`
InternalID string `json:"internalId"`
Labels []string `json:"labels"`
Properties JSON `json:"properties"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
DecayScore *float64 `json:"decayScore,omitempty"`
LastAccessed *time.Time `json:"lastAccessed,omitempty"`
AccessCount *int `json:"accessCount,omitempty"`
HasEmbedding bool `json:"hasEmbedding"`
EmbeddingDimensions int `json:"embeddingDimensions"`
}
Node represents a graph node.
type Relationship ¶
type Relationship struct {
ID string `json:"id"`
InternalID string `json:"internalId"`
Type string `json:"type"`
StartNodeElementID string `json:"startNodeElementId"` // Neo4j-style elementId
EndNodeElementID string `json:"endNodeElementId"` // Neo4j-style elementId
StartNodeID string `json:"startNodeId"` // Used for resolution (deprecated)
EndNodeID string `json:"endNodeId"` // Used for resolution (deprecated)
Properties JSON `json:"properties"`
CreatedAt *time.Time `json:"createdAt,omitempty"`
UpdatedAt *time.Time `json:"updatedAt,omitempty"`
Confidence *float64 `json:"confidence,omitempty"`
AutoGenerated bool `json:"autoGenerated"`
}
Relationship represents a graph relationship.
type RelationshipDirection ¶
type RelationshipDirection string
RelationshipDirection represents traversal direction.
const ( RelationshipDirectionOutgoing RelationshipDirection = "OUTGOING" RelationshipDirectionIncoming RelationshipDirection = "INCOMING" RelationshipDirectionBoth RelationshipDirection = "BOTH" )
func (RelationshipDirection) IsValid ¶
func (e RelationshipDirection) IsValid() bool
func (RelationshipDirection) MarshalGQL ¶
func (e RelationshipDirection) MarshalGQL(w io.Writer)
func (RelationshipDirection) String ¶
func (e RelationshipDirection) String() string
func (*RelationshipDirection) UnmarshalGQL ¶
func (e *RelationshipDirection) UnmarshalGQL(v interface{}) error
type RelationshipTypeStats ¶
RelationshipTypeStats represents statistics for a relationship type.
type SchemaConstraint ¶
type SchemaConstraint struct {
Name string `json:"name"`
Type string `json:"type"`
EntityType string `json:"entityType"`
LabelsOrTypes []string `json:"labelsOrTypes"`
Properties []string `json:"properties"`
}
SchemaConstraint represents a schema constraint.
type SearchMethod ¶
type SearchMethod string
SearchMethod represents the search algorithm to use.
const ( SearchMethodHybrid SearchMethod = "HYBRID" SearchMethodVector SearchMethod = "VECTOR" SearchMethodBm25 SearchMethod = "BM25" )
func (SearchMethod) IsValid ¶
func (e SearchMethod) IsValid() bool
func (SearchMethod) MarshalGQL ¶
func (e SearchMethod) MarshalGQL(w io.Writer)
func (SearchMethod) String ¶
func (e SearchMethod) String() string
func (*SearchMethod) UnmarshalGQL ¶
func (e *SearchMethod) UnmarshalGQL(v interface{}) error
type SearchOptions ¶
type SearchOptions struct {
Limit *int `json:"limit,omitempty"`
Offset *int `json:"offset,omitempty"`
Labels []string `json:"labels,omitempty"`
Method *SearchMethod `json:"method,omitempty"`
MinScore *float64 `json:"minScore,omitempty"`
SortBy *SearchSortBy `json:"sortBy,omitempty"`
SortOrder *SortOrder `json:"sortOrder,omitempty"`
IncludeDecayed *bool `json:"includeDecayed,omitempty"`
MinDecayScore *float64 `json:"minDecayScore,omitempty"`
PropertyFilters JSON `json:"propertyFilters,omitempty"`
}
SearchOptions represents search query options.
type SearchResponse ¶
type SearchResponse struct {
Results []*SearchResult `json:"results"`
TotalCount int `json:"totalCount"`
Method string `json:"method"`
ExecutionTimeMs float64 `json:"executionTimeMs"`
VectorSearchUsed bool `json:"vectorSearchUsed"`
BM25SearchUsed bool `json:"bm25SearchUsed"`
}
SearchResponse represents search results with metadata.
type SearchResult ¶
type SearchResult struct {
Node *Node `json:"node"`
Score float64 `json:"score"`
RRFScore *float64 `json:"rrfScore,omitempty"`
VectorScore *float64 `json:"vectorScore,omitempty"`
BM25Score *float64 `json:"bm25Score,omitempty"`
VectorRank *int `json:"vectorRank,omitempty"`
BM25Rank *int `json:"bm25Rank,omitempty"`
FoundBy []string `json:"foundBy"`
}
SearchResult represents a search hit with scores.
type SearchSortBy ¶
type SearchSortBy string
SearchSortBy represents search result sorting options.
const ( SearchSortByRelevance SearchSortBy = "RELEVANCE" SearchSortByCreatedAt SearchSortBy = "CREATED_AT" SearchSortByLastAccessed SearchSortBy = "LAST_ACCESSED" SearchSortByDecayScore SearchSortBy = "DECAY_SCORE" SearchSortByAccessCount SearchSortBy = "ACCESS_COUNT" )
func (SearchSortBy) IsValid ¶
func (e SearchSortBy) IsValid() bool
func (SearchSortBy) MarshalGQL ¶
func (e SearchSortBy) MarshalGQL(w io.Writer)
func (SearchSortBy) String ¶
func (e SearchSortBy) String() string
func (*SearchSortBy) UnmarshalGQL ¶
func (e *SearchSortBy) UnmarshalGQL(v interface{}) error
type SimilarNode ¶
SimilarNode represents a similar node with score.
type SortOrder ¶
type SortOrder string
SortOrder represents ascending/descending sort.
func (SortOrder) MarshalGQL ¶
func (*SortOrder) UnmarshalGQL ¶
type Subgraph ¶
type Subgraph struct {
Nodes []*Node `json:"nodes"`
Relationships []*Relationship `json:"relationships"`
}
Subgraph represents a collection of nodes and relationships.
type Subscription ¶
type Subscription struct {
}
type UpdateNodeInput ¶
type UpdateNodeInput struct {
ID string `json:"id"`
Labels []string `json:"labels,omitempty"`
Properties JSON `json:"properties,omitempty"`
RemoveProperties []string `json:"removeProperties,omitempty"`
AddLabels []string `json:"addLabels,omitempty"`
RemoveLabels []string `json:"removeLabels,omitempty"`
Embedding FloatArray `json:"embedding,omitempty"`
}
UpdateNodeInput represents input for updating a node.
type UpdateRelationshipInput ¶
type UpdateRelationshipInput struct {
ID string `json:"id"`
Type *string `json:"type,omitempty"`
Properties JSON `json:"properties,omitempty"`
RemoveProperties []string `json:"removeProperties,omitempty"`
}
UpdateRelationshipInput represents input for updating a relationship.