Documentation
¶
Index ¶
- Variables
- func AsDriver[T any](db Database) (T, bool)
- func AsNumeric[T numeric](rawValue any) (T, error)
- func AsNumericSlice[T numeric](rawValue any) ([]T, error)
- func AsTime(value any) (time.Time, bool)
- func FormatPathSegment(segment *PathSegment) string
- func IDsToUint32Slice(ids []ID) []uint32
- func IDsToUint64Slice(ids []ID) []uint64
- func IsDriver[T any](db Database) bool
- func IsErrNotFound(err error) bool
- func IsErrPropertyNotFound(err error) bool
- func IsMissingResultExpectation(err error) bool
- func NewError(query string, driverErr error) error
- func NodeIDsToDuplex(nodeIDs []ID) cardinality.Duplex[uint64]
- func NodeSetToBitmap(nodes NodeSet) cardinality.Duplex[uint64]
- func NodeSetToDuplex(nodes NodeSet) cardinality.Duplex[uint64]
- func ScanNextResult(result Result, targets ...any) error
- func SliceOf[T any](raw any) ([]T, error)
- func SortIDSlice(ids []ID)
- type Batch
- type BatchConfig
- type BatchDelegate
- type BatchOption
- type Constraint
- type Criteria
- type CriteriaProvider
- type Cursor
- type Database
- type DatabaseSwitch
- func (s *DatabaseSwitch) AssertSchema(ctx context.Context, dbSchema Schema) error
- func (s *DatabaseSwitch) BatchOperation(ctx context.Context, batchDelegate BatchDelegate, options ...BatchOption) error
- func (s *DatabaseSwitch) Close(ctx context.Context) error
- func (s *DatabaseSwitch) FetchKinds(ctx context.Context) (Kinds, error)
- func (s *DatabaseSwitch) ReadTransaction(ctx context.Context, txDelegate TransactionDelegate, ...) error
- func (s *DatabaseSwitch) RefreshKinds(ctx context.Context) error
- func (s *DatabaseSwitch) Run(ctx context.Context, query string, parameters map[string]any) error
- func (s *DatabaseSwitch) SetBatchWriteSize(interval int)
- func (s *DatabaseSwitch) SetDefaultGraph(ctx context.Context, graphSchema Graph) error
- func (s *DatabaseSwitch) SetWriteFlushSize(interval int)
- func (s *DatabaseSwitch) Switch(db Database)
- func (s *DatabaseSwitch) WriteTransaction(ctx context.Context, txDelegate TransactionDelegate, ...) error
- type Direction
- func (s Direction) Pick(relationship *Relationship) (ID, error)
- func (s Direction) PickID(start, end ID) (ID, error)
- func (s Direction) PickReverse(relationship *Relationship) (ID, error)
- func (s Direction) PickReverseID(start, end ID) (ID, error)
- func (s Direction) Reverse() Direction
- func (s Direction) String() string
- type DirectionalResult
- type ErrorResult
- type Graph
- type ID
- type Index
- type IndexType
- type IndexedSlice
- func (s *IndexedSlice[K, V]) CheckedGet(key K) (V, bool)
- func (s *IndexedSlice[K, V]) Each(delegate func(key K, value V) bool)
- func (s *IndexedSlice[K, V]) Get(key K) V
- func (s *IndexedSlice[K, V]) GetAll(keys []K) ([]V, []K)
- func (s *IndexedSlice[K, V]) GetAllIndexed(keys []K) (*IndexedSlice[K, V], []K)
- func (s *IndexedSlice[K, V]) GetOr(key K, defaultConstructor func() V) V
- func (s *IndexedSlice[K, V]) Has(key K) bool
- func (s *IndexedSlice[K, V]) Keys() []K
- func (s *IndexedSlice[K, V]) Len() int
- func (s *IndexedSlice[K, V]) Merge(other *IndexedSlice[K, V])
- func (s *IndexedSlice[K, V]) Put(key K, value V)
- func (s *IndexedSlice[K, V]) SizeOf() size.Size
- func (s *IndexedSlice[K, V]) Values() []V
- type Kind
- type KindBitmaps
- func (s KindBitmaps) AddDuplexToKind(ids cardinality.Duplex[uint64], kind Kind)
- func (s KindBitmaps) AddIDToKind(id ID, kind Kind)
- func (s KindBitmaps) AddIDToKinds(id ID, kinds Kinds)
- func (s KindBitmaps) AddNodes(nodes ...*Node)
- func (s KindBitmaps) AddSets(nodeSets ...NodeSet)
- func (s KindBitmaps) Contains(node *Node) bool
- func (s KindBitmaps) Count(kinds ...Kind) uint64
- func (s KindBitmaps) Get(kinds ...Kind) cardinality.Duplex[uint64]
- func (s KindBitmaps) Or(bitmaps KindBitmaps)
- func (s KindBitmaps) OrAll() cardinality.Duplex[uint64]
- type Kinds
- func (s Kinds) Add(kinds ...Kind) Kinds
- func (s Kinds) Concatenate(kinds Kinds) Kinds
- func (s Kinds) ConcatenateAll(kindBags ...Kinds) Kinds
- func (s Kinds) ContainsOneOf(others ...Kind) bool
- func (s Kinds) Copy() Kinds
- func (s Kinds) Exclude(exclusions Kinds) Kinds
- func (s Kinds) HashInto(h *xxhash.Digest) error
- func (s Kinds) Remove(kind Kind) Kinds
- func (s Kinds) SizeOf() size.Size
- func (s Kinds) Strings() []string
- type KindsResult
- type Literal
- type Literals
- type MapFunc
- type Node
- type NodeKindSet
- func (s NodeKindSet) Add(nodes ...*Node)
- func (s NodeKindSet) AddKindSet(set NodeKindSet)
- func (s NodeKindSet) AddSets(nodeSets ...NodeSet)
- func (s NodeKindSet) AllNodeIDs() []ID
- func (s NodeKindSet) AllNodes() NodeSet
- func (s NodeKindSet) Copy() NodeKindSet
- func (s NodeKindSet) Count(kinds ...Kind) int64
- func (s NodeKindSet) CountAll() int64
- func (s NodeKindSet) EachNode(delegate func(node *Node) error) error
- func (s NodeKindSet) Get(kind Kind) NodeSet
- func (s NodeKindSet) GetCombined(kinds ...Kind) NodeSet
- func (s NodeKindSet) GetNode(id ID) *Node
- func (s NodeKindSet) RemoveNode(id ID)
- type NodeQuery
- type NodeSet
- func (s NodeSet) Add(nodes ...*Node)
- func (s NodeSet) AddIfNotExists(node *Node) bool
- func (s NodeSet) AddSet(set NodeSet)
- func (s NodeSet) ContainingNodeKinds(kinds ...Kind) NodeSet
- func (s NodeSet) Contains(node *Node) bool
- func (s NodeSet) ContainsID(id ID) bool
- func (s NodeSet) Copy() NodeSet
- func (s NodeSet) Get(id ID) *Node
- func (s NodeSet) IDBitmap() cardinality.Duplex[uint64]
- func (s NodeSet) IDs() []ID
- func (s NodeSet) KindSet() NodeKindSet
- func (s NodeSet) Len() int
- func (s NodeSet) Pick() *Node
- func (s NodeSet) Remove(id ID)
- func (s NodeSet) Slice() []*Node
- func (s *NodeSet) UnmarshalJSON(input []byte) error
- type NodeUpdate
- type Path
- type PathSegment
- func (s *PathSegment) Depth() int
- func (s *PathSegment) Descend(node *Node, relationship *Relationship) *PathSegment
- func (s *PathSegment) Detach()
- func (s *PathSegment) GetTrunkSegment() *PathSegment
- func (s *PathSegment) IsCycle() bool
- func (s *PathSegment) Path() Path
- func (s *PathSegment) Search(delegate func(nextSegment *PathSegment) bool) *Node
- func (s *PathSegment) SizeOf() size.Size
- func (s *PathSegment) Slice() []*PathSegment
- func (s *PathSegment) WalkReverse(delegate func(nextSegment *PathSegment) bool)
- type PathSet
- func (s *PathSet) AddPath(path Path)
- func (s *PathSet) AddPathSet(pathSet PathSet)
- func (s PathSet) AllNodes() NodeSet
- func (s PathSet) ExcludeByEdgeKinds(edgeKinds Kinds) PathSet
- func (s PathSet) FilterByEdge(filter func(edge *Relationship) bool) PathSet
- func (s PathSet) IncludeByEdgeKinds(edgeKinds Kinds) PathSet
- func (s PathSet) Len() int
- func (s PathSet) Paths() []Path
- func (s PathSet) Roots() NodeSet
- func (s PathSet) Terminals() NodeSet
- type Properties
- func (s *Properties) Clone() *Properties
- func (s *Properties) Delete(key string) *Properties
- func (s *Properties) DeletedProperties() []string
- func (s *Properties) Exists(key string) bool
- func (s *Properties) Get(key string) PropertyValue
- func (s *Properties) GetOrDefault(key string, defaultValue any) PropertyValue
- func (s *Properties) GetWithFallback(key string, defaultValue any, fallbackKeys ...string) PropertyValue
- func (s *Properties) HashInto(h *xxhash.Digest, ignoredKeys map[string]struct{}) error
- func (s *Properties) Keys(ignoredKeys map[string]struct{}) []string
- func (s *Properties) Len() int
- func (s *Properties) MapOrEmpty() map[string]any
- func (s *Properties) Merge(other *Properties)
- func (s *Properties) ModifiedProperties() map[string]any
- func (s *Properties) Set(key string, value any) *Properties
- func (s *Properties) SetAll(other map[string]any) *Properties
- func (s *Properties) SizeOf() size.Size
- type PropertyMap
- type PropertyValue
- type Relationship
- type RelationshipKindsResult
- type RelationshipQuery
- type RelationshipSet
- func (s RelationshipSet) Add(relationships ...*Relationship)
- func (s RelationshipSet) AddSet(other RelationshipSet)
- func (s RelationshipSet) Contains(relationship *Relationship) bool
- func (s RelationshipSet) ContainsID(id ID) bool
- func (s RelationshipSet) Get(id ID) *Relationship
- func (s RelationshipSet) IDBitmap() cardinality.Duplex[uint64]
- func (s RelationshipSet) Len() int
- func (s RelationshipSet) Slice() []*Relationship
- type RelationshipTripleResult
- type RelationshipUpdate
- type Result
- type ResultIterator
- type ResultMarshaller
- type Schema
- type String
- type ThreadSafeKindBitmap
- func (s ThreadSafeKindBitmap) Add(kind Kind, value uint64)
- func (s ThreadSafeKindBitmap) Cardinality(kinds ...Kind) uint64
- func (s ThreadSafeKindBitmap) CheckedAdd(kind Kind, value uint64) bool
- func (s ThreadSafeKindBitmap) Clone() *ThreadSafeKindBitmap
- func (s ThreadSafeKindBitmap) Contains(kind Kind, value uint64) bool
- func (s ThreadSafeKindBitmap) Get(kinds ...Kind) cardinality.Duplex[uint64]
- func (s ThreadSafeKindBitmap) Or(kind Kind, other cardinality.Duplex[uint64])
- type ThreadSafeNodeSet
- func (s *ThreadSafeNodeSet) Add(nodes ...*Node)
- func (s *ThreadSafeNodeSet) AddIfNotExists(node *Node) bool
- func (s *ThreadSafeNodeSet) AddSet(set NodeSet)
- func (s ThreadSafeNodeSet) ContainingNodeKinds(kinds ...Kind) NodeSet
- func (s ThreadSafeNodeSet) Contains(node *Node) bool
- func (s ThreadSafeNodeSet) ContainsID(id ID) bool
- func (s ThreadSafeNodeSet) Copy() ThreadSafeNodeSet
- func (s ThreadSafeNodeSet) Get(id ID) *Node
- func (s ThreadSafeNodeSet) IDBitmap() cardinality.Duplex[uint64]
- func (s ThreadSafeNodeSet) IDs() []ID
- func (s ThreadSafeNodeSet) KindSet() NodeKindSet
- func (s ThreadSafeNodeSet) Len() int
- func (s ThreadSafeNodeSet) Pick() *Node
- func (s *ThreadSafeNodeSet) Remove(id ID)
- func (s ThreadSafeNodeSet) Slice() []*Node
- type Transaction
- type TransactionConfig
- type TransactionDelegate
- type TransactionOption
- type Tree
- type ValueMapper
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoResultsFound may be returned when the result set does not contain a result matching the query specifications. ErrNoResultsFound = errors.New("not found") // ErrMissingResultExpectation may be returned when the result set does not adhere to driver expectations. For // example when a query result does not contain an expected value or variable. ErrMissingResultExpectation = errors.New("missing result expectation") // ErrUnsupportedDatabaseOperation may be returned to signal to a user that the DAWGS driver they are using does not // support the operation they are attempting to execute. This error should be used sparingly. All DAWGS drivers // should strive to satisfy all DAWGS contracts even if the resulting implementation is non-optimal. ErrUnsupportedDatabaseOperation = errors.New("unsupported database operation") // ErrPropertyNotFound is returned when a node or relationship property is found to be nil during type negotiation. ErrPropertyNotFound = errors.New("property not found") // ErrContextTimedOut is used to mark that an operation was halted due to the context hitting its deadline ErrContextTimedOut = errors.New("context timed out") // ErrConcurrentConnectionSlotTimeOut is used to mark that an operation failed due to being unable to acquire a // concurrent connection slot ErrConcurrentConnectionSlotTimeOut = errors.New("context timed out") )
var (
EmptyKind = StringKind("")
)
var (
ErrAuthoritativeDatabaseSwitching = errors.New("switching authoritative database")
)
var ErrInvalidDirection = errors.New("must be called with either an inbound or outbound direction")
Functions ¶
func AsNumericSlice ¶
func FormatPathSegment ¶
func FormatPathSegment(segment *PathSegment) string
FormatPathSegment outputs a cypher-formatted path from the given PathSegment pointer
func IDsToUint32Slice ¶
func IDsToUint64Slice ¶
func IsErrNotFound ¶
func IsErrPropertyNotFound ¶
func NodeIDsToDuplex ¶
func NodeIDsToDuplex(nodeIDs []ID) cardinality.Duplex[uint64]
NodeSetToDuplex takes a graph NodeSet and returns a Duplex provider that contains all node IDs.
func NodeSetToBitmap ¶ added in v0.1.1
func NodeSetToBitmap(nodes NodeSet) cardinality.Duplex[uint64]
func NodeSetToDuplex ¶
func NodeSetToDuplex(nodes NodeSet) cardinality.Duplex[uint64]
NodeSetToDuplex takes a graph NodeSet and returns a Duplex provider that contains all node IDs.
func ScanNextResult ¶
func SortIDSlice ¶
func SortIDSlice(ids []ID)
Types ¶
type Batch ¶
type Batch interface {
// WithGraph scopes the transaction to a specific graph. If the driver for the transaction does not support
// multiple graphs the resulting transaction will target the default graph instead and this call becomes a no-op.
WithGraph(graphSchema Graph) Batch
// CreateNode creates a new Node in the database and returns the creation as a NodeResult.
CreateNode(node *Node) error
// DeleteNode deletes a node by the given ID.
DeleteNode(id ID) error
// Nodes begins a batch query that can be used to update or delete nodes.
Nodes() NodeQuery
// Relationships begins a batch query that can be used to update or delete relationships.
Relationships() RelationshipQuery
// UpdateNodeBy is a stop-gap until the query interface can better support targeted batch create-update operations.
// Nodes identified by the NodeUpdate criteria will either be updated or in the case where the node does not yet
// exist, created.
UpdateNodeBy(update NodeUpdate) error
// Updates nodes by ID
UpdateNodes(nodes []*Node) error
// TODO: Existing batch logic expects this to perform an upsert on conficts with (start_id, end_id, kind). This is incorrect and should be refactored
CreateRelationship(relationship *Relationship) error
// Deprecated: Use CreateRelationship Instead
//
// CreateRelationshipByIDs creates a new Relationship from the start Node to the end Node with the given Kind and
// Properties and returns the creation as a RelationshipResult.
CreateRelationshipByIDs(startNodeID, endNodeID ID, kind Kind, properties *Properties) error
// DeleteRelationship deletes a relationship by the given ID.
DeleteRelationship(id ID) error
// UpdateRelationshipBy is a stop-gap until the query interface can better support targeted batch create-update
// operations. Relationships identified by the RelationshipUpdate criteria will either be updated or in the case
// where the relationship does not yet exist, created.
UpdateRelationshipBy(update RelationshipUpdate) error
// Commit calls to commit this batch transaction right away.
Commit() error
}
type BatchConfig ¶ added in v0.4.12
type BatchConfig struct {
BatchSize int
}
type BatchDelegate ¶
BatchDelegate represents a transactional database context actor.
type BatchOption ¶ added in v0.4.12
type BatchOption func(config *BatchConfig)
func WithBatchSize ¶ added in v0.4.12
func WithBatchSize(size int) BatchOption
type Constraint ¶
type Constraint Index
type Criteria ¶
type Criteria any
Criteria is a top-level alias for communicating structured query filter criteria to a query generator.
type CriteriaProvider ¶
type CriteriaProvider func() Criteria
CriteriaProvider is a function delegate that returns criteria.
type Cursor ¶
type Cursor[T any] interface { // Error returns the error reference captured by this Result. When DAWGS database calls fail this value must be // populated by the underlying driver. Error() error // Close releases any active resources bound to this cursor Close() // Chan returns the type channel backed by this database cursor Chan() chan T }
Cursor is an interface that represents an active database operation. Cursors must be closed to prevent resource leaks.
func NewResultIterator ¶
type Database ¶
type Database interface {
// SetWriteFlushSize sets a new write flush interval on the current driver
SetWriteFlushSize(interval int)
// SetBatchWriteSize sets a new batch write interval on the current driver
SetBatchWriteSize(interval int)
// ReadTransaction opens up a new read transactional context in the database and then defers the context to the
// given logic function.
ReadTransaction(ctx context.Context, txDelegate TransactionDelegate, options ...TransactionOption) error
// WriteTransaction opens up a new write transactional context in the database and then defers the context to the
// given logic function.
WriteTransaction(ctx context.Context, txDelegate TransactionDelegate, options ...TransactionOption) error
// BatchOperation opens up a new write transactional context in the database and then defers the context to the
// given logic function. Batch operations are fundamentally different between databases supported by DAWGS,
// necessitating a different interface that lacks many of the convenience features of a regular read or write
// transaction.
BatchOperation(ctx context.Context, batchDelegate BatchDelegate, options ...BatchOption) error
// AssertSchema will apply the given schema to the underlying database.
AssertSchema(ctx context.Context, dbSchema Schema) error
// SetDefaultGraph sets the default graph namespace for the connection.
SetDefaultGraph(ctx context.Context, graphSchema Graph) error
// Run allows a user to pass statements directly to the database. Since results may rely on a transactional context
// only an error is returned from this function
Run(ctx context.Context, query string, parameters map[string]any) error
// Close closes the database context and releases any pooled resources held by the instance.
Close(ctx context.Context) error
// FetchKinds retrieves the complete list of kinds available to the database.
FetchKinds(ctx context.Context) (Kinds, error)
// RefreshKinds refreshes the in memory kinds maps
RefreshKinds(ctx context.Context) error
}
Database is a high-level interface representing transactional entry-points into DAWGS driver implementations.
type DatabaseSwitch ¶
type DatabaseSwitch struct {
// contains filtered or unexported fields
}
func NewDatabaseSwitch ¶
func NewDatabaseSwitch(ctx context.Context, initialDB Database) *DatabaseSwitch
func (*DatabaseSwitch) AssertSchema ¶
func (s *DatabaseSwitch) AssertSchema(ctx context.Context, dbSchema Schema) error
func (*DatabaseSwitch) BatchOperation ¶
func (s *DatabaseSwitch) BatchOperation(ctx context.Context, batchDelegate BatchDelegate, options ...BatchOption) error
func (*DatabaseSwitch) FetchKinds ¶
func (s *DatabaseSwitch) FetchKinds(ctx context.Context) (Kinds, error)
func (*DatabaseSwitch) ReadTransaction ¶
func (s *DatabaseSwitch) ReadTransaction(ctx context.Context, txDelegate TransactionDelegate, options ...TransactionOption) error
func (*DatabaseSwitch) RefreshKinds ¶
func (s *DatabaseSwitch) RefreshKinds(ctx context.Context) error
func (*DatabaseSwitch) SetBatchWriteSize ¶
func (s *DatabaseSwitch) SetBatchWriteSize(interval int)
func (*DatabaseSwitch) SetDefaultGraph ¶
func (s *DatabaseSwitch) SetDefaultGraph(ctx context.Context, graphSchema Graph) error
func (*DatabaseSwitch) SetWriteFlushSize ¶
func (s *DatabaseSwitch) SetWriteFlushSize(interval int)
func (*DatabaseSwitch) Switch ¶
func (s *DatabaseSwitch) Switch(db Database)
func (*DatabaseSwitch) WriteTransaction ¶
func (s *DatabaseSwitch) WriteTransaction(ctx context.Context, txDelegate TransactionDelegate, options ...TransactionOption) error
type Direction ¶
type Direction int
Direction describes the direction of a graph traversal. A Direction may be either Inbound or DirectionOutbound.
const ( DirectionInbound Direction = 0 DirectionOutbound Direction = 1 DirectionBoth Direction = 2 End = DirectionInbound Start = DirectionOutbound )
func (Direction) Pick ¶
func (s Direction) Pick(relationship *Relationship) (ID, error)
Pick picks either the start or end Node ID from a Relationship depending on the direction of the receiver.
func (Direction) PickID ¶
PickID picks either the start or end Node ID from a Relationship depending on the direction of the receiver.
func (Direction) PickReverse ¶
func (s Direction) PickReverse(relationship *Relationship) (ID, error)
PickReverse picks either the start or end Node ID from a Relationship depending on the direction of the receiver.
func (Direction) PickReverseID ¶
PickReverseID picks either the start or end Node ID from a Relationship depending on the direction of the receiver.
type DirectionalResult ¶
type DirectionalResult struct {
Direction Direction
Relationship *Relationship
Node *Node
}
func NewDirectionalResult ¶
func NewDirectionalResult(direction Direction, relationship *Relationship, node *Node) DirectionalResult
type ErrorResult ¶
type ErrorResult struct {
// contains filtered or unexported fields
}
func (ErrorResult) Close ¶
func (s ErrorResult) Close()
func (ErrorResult) Error ¶
func (s ErrorResult) Error() error
func (ErrorResult) Keys ¶ added in v0.4.4
func (s ErrorResult) Keys() []string
func (ErrorResult) Mapper ¶
func (s ErrorResult) Mapper() ValueMapper
func (ErrorResult) Next ¶
func (s ErrorResult) Next() bool
func (ErrorResult) Scan ¶
func (s ErrorResult) Scan(targets ...any) error
func (ErrorResult) Values ¶
func (s ErrorResult) Values() []any
type Graph ¶
type Graph struct {
Name string
Nodes Kinds
Edges Kinds
NodeConstraints []Constraint
EdgeConstraints []Constraint
NodeIndexes []Index
EdgeIndexes []Index
}
type ID ¶
type ID uint64
ID is a 64-bit database Entity identifier type. Negative ID value associations in DAWGS drivers are not recommended and should not be considered during driver implementation.
func CopyIDSlice ¶ added in v0.1.1
func DuplexToGraphIDs ¶
func DuplexToGraphIDs[T uint32 | uint64](provider cardinality.Duplex[T]) []ID
DuplexToGraphIDs takes a Duplex provider and returns a slice of graph IDs.
func Uint32SliceToIDs ¶
func Uint64SliceToIDs ¶
type IndexedSlice ¶
type IndexedSlice[K comparable, V any] struct { // contains filtered or unexported fields }
IndexedSlice is a structure maps a comparable key to a value that implements size.Sizable.
func NewIndexedSlice ¶
func NewIndexedSlice[K comparable, V any]() *IndexedSlice[K, V]
func (*IndexedSlice[K, V]) CheckedGet ¶
func (s *IndexedSlice[K, V]) CheckedGet(key K) (V, bool)
CheckedGet returns a tuple containing the value and a boolean representing if a value was found for the given key.
func (*IndexedSlice[K, V]) Each ¶
func (s *IndexedSlice[K, V]) Each(delegate func(key K, value V) bool)
func (*IndexedSlice[K, V]) Get ¶
func (s *IndexedSlice[K, V]) Get(key K) V
func (*IndexedSlice[K, V]) GetAll ¶
func (s *IndexedSlice[K, V]) GetAll(keys []K) ([]V, []K)
GetAll returns all found values for a given slice of keys. Any keys that do not have stored values in this IndexedSlice are returned as the second value of the tuple return for this function.
func (*IndexedSlice[K, V]) GetAllIndexed ¶
func (s *IndexedSlice[K, V]) GetAllIndexed(keys []K) (*IndexedSlice[K, V], []K)
GetAllIndexed returns all found values for a given slice of keys. Any keys that do not have stored values in this IndexedSlice are returned as the second value of the tuple return for this function.
func (*IndexedSlice[K, V]) GetOr ¶
func (s *IndexedSlice[K, V]) GetOr(key K, defaultConstructor func() V) V
func (*IndexedSlice[K, V]) Has ¶
func (s *IndexedSlice[K, V]) Has(key K) bool
func (*IndexedSlice[K, V]) Keys ¶
func (s *IndexedSlice[K, V]) Keys() []K
func (*IndexedSlice[K, V]) Len ¶
func (s *IndexedSlice[K, V]) Len() int
Len returns the number of values stored.
func (*IndexedSlice[K, V]) Merge ¶
func (s *IndexedSlice[K, V]) Merge(other *IndexedSlice[K, V])
func (*IndexedSlice[K, V]) Put ¶
func (s *IndexedSlice[K, V]) Put(key K, value V)
Put inserts the given value with the given key.
func (*IndexedSlice[K, V]) SizeOf ¶
func (s *IndexedSlice[K, V]) SizeOf() size.Size
SizeOf returns the relative size of the IndexedSlice instance.
func (*IndexedSlice[K, V]) Values ¶
func (s *IndexedSlice[K, V]) Values() []V
type Kind ¶
type Kind interface {
String
// Is returns true if the other Kind matches the Kind represented by this interface.
Is(other ...Kind) bool
}
Kind is an interface that represents a DAWGS Node's type. Simple constant enumerations are encouraged when satisfying the Kind contract. Kind implementations must implement all functions of the Kind contract.
func StringKind ¶
type KindBitmaps ¶
type KindBitmaps map[string]cardinality.Duplex[uint64]
func (KindBitmaps) AddDuplexToKind ¶
func (s KindBitmaps) AddDuplexToKind(ids cardinality.Duplex[uint64], kind Kind)
func (KindBitmaps) AddIDToKind ¶
func (s KindBitmaps) AddIDToKind(id ID, kind Kind)
func (KindBitmaps) AddIDToKinds ¶
func (s KindBitmaps) AddIDToKinds(id ID, kinds Kinds)
func (KindBitmaps) AddNodes ¶
func (s KindBitmaps) AddNodes(nodes ...*Node)
func (KindBitmaps) AddSets ¶
func (s KindBitmaps) AddSets(nodeSets ...NodeSet)
func (KindBitmaps) Contains ¶
func (s KindBitmaps) Contains(node *Node) bool
func (KindBitmaps) Count ¶
func (s KindBitmaps) Count(kinds ...Kind) uint64
func (KindBitmaps) Get ¶
func (s KindBitmaps) Get(kinds ...Kind) cardinality.Duplex[uint64]
func (KindBitmaps) Or ¶
func (s KindBitmaps) Or(bitmaps KindBitmaps)
func (KindBitmaps) OrAll ¶
func (s KindBitmaps) OrAll() cardinality.Duplex[uint64]
type Kinds ¶
type Kinds []Kind
Kinds is a type alias for []Kind that adds some additional convenience receiver functions.
func StringsToKinds ¶
func (Kinds) Concatenate ¶
func (Kinds) ConcatenateAll ¶
func (Kinds) ContainsOneOf ¶
ContainsOneOf returns true if the Kinds contains one of the given Kind types or false if it does not.
type KindsResult ¶
type Node ¶
type Node struct {
ID ID `json:"id"`
Kinds Kinds `json:"kinds"`
AddedKinds Kinds `json:"added_kinds"`
DeletedKinds Kinds `json:"deleted_kinds"`
Properties *Properties `json:"properties"`
}
func PrepareNode ¶
func PrepareNode(properties *Properties, kinds ...Kind) *Node
func SortNodeSetById ¶
func (*Node) DeleteKinds ¶
func (*Node) MarshalJSON ¶
func (*Node) StripAllPropertiesExcept ¶ added in v0.4.12
StripAllPropertiesExcept removes all properties from the node except for the ones specified in the except list. Deleted properties are also removed from the node, except for the ones specified in the except list. The use case for this function is if you have fully hydrated nodes in memory, but only want to update a few properties it is most efficient to strip all properties except for the ones you want to update.
type NodeKindSet ¶
func NewNodeKindSet ¶
func NewNodeKindSet(nodeSets ...NodeSet) NodeKindSet
func (NodeKindSet) Add ¶
func (s NodeKindSet) Add(nodes ...*Node)
Add adds the given list of Node types to this NodeKindSet.
func (NodeKindSet) AddKindSet ¶
func (s NodeKindSet) AddKindSet(set NodeKindSet)
AddKindSet adds the given NodeKindSet to this NodeKindSet.
func (NodeKindSet) AddSets ¶
func (s NodeKindSet) AddSets(nodeSets ...NodeSet)
AddSets adds the given NodeSet instances to this NodeKindSet.
func (NodeKindSet) AllNodeIDs ¶
func (s NodeKindSet) AllNodeIDs() []ID
AllNodeIDs returns all node IDs contained with in this set.
func (NodeKindSet) AllNodes ¶
func (s NodeKindSet) AllNodes() NodeSet
AllNodes returns all nodes present in this set as a NodeSet.
func (NodeKindSet) Copy ¶
func (s NodeKindSet) Copy() NodeKindSet
Copy returns a shallow copy of this set.
func (NodeKindSet) Count ¶
func (s NodeKindSet) Count(kinds ...Kind) int64
Count returns the count unique nodes for each given kind, summed.
func (NodeKindSet) CountAll ¶
func (s NodeKindSet) CountAll() int64
CountAll returns the count of all unique nodes in the set.
func (NodeKindSet) EachNode ¶
func (s NodeKindSet) EachNode(delegate func(node *Node) error) error
EachNode iterates through each node contained within this set.
func (NodeKindSet) Get ¶
func (s NodeKindSet) Get(kind Kind) NodeSet
Get returns the NodeSet for a given Kind. If there is no NodeSet for the given Kind then an empty NodeSet is returned.
func (NodeKindSet) GetCombined ¶
func (s NodeKindSet) GetCombined(kinds ...Kind) NodeSet
GetCombined returns a NodeSet of all nodes contained in this set that match the given kinds.
func (NodeKindSet) GetNode ¶
func (s NodeKindSet) GetNode(id ID) *Node
GetNode fetches a Node from this set by its database ID.
func (NodeKindSet) RemoveNode ¶
func (s NodeKindSet) RemoveNode(id ID)
RemoveNode removes a Node from this set by its database ID.
type NodeQuery ¶
type NodeQuery interface {
// Filter applies the given criteria to this query.
Filter(criteria Criteria) NodeQuery
// Filterf applies the given criteria provider function to this query.
Filterf(criteriaDelegate CriteriaProvider) NodeQuery
// Query completes the query and hands the raw result to the given delegate for unmarshalling
Query(delegate func(results Result) error, finalCriteria ...Criteria) error
// Delete deletes any candidate nodes that match the query criteria
Delete() error
// Update updates all candidate nodes with the given properties
Update(properties *Properties) error
// OrderBy sets the OrderBy clause of the NodeQuery.
OrderBy(criteria ...Criteria) NodeQuery
// Offset sets an offset for the result set of the query. Using this function will enforce order on the result set.
Offset(skip int) NodeQuery
// Limit sets a maximum number of results to collect from the database.
Limit(skip int) NodeQuery
// Count completes the query and returns a tuple containing the count of results that were addressed by the
// database and any error encountered during execution.
Count() (int64, error)
// First completes the query and returns the result and any error encountered during execution.
First() (*Node, error)
// Fetch completes the query and captures a cursor for iterating the result set. This cursor is passed to the given
// delegate. Errors from the delegate are returned upwards as the error result of this call.
Fetch(delegate func(cursor Cursor[*Node]) error, finalCriteria ...Criteria) error
// FetchIDs completes the query and captures a cursor for iterating the result set. This cursor is passed to the given
// delegate. Errors from the delegate are returned upwards as the error result of this call.
FetchIDs(delegate func(cursor Cursor[ID]) error) error
// FetchKinds returns the ID and Kinds of matched nodes and omits property fetching
FetchKinds(func(cursor Cursor[KindsResult]) error) error
}
NodeQuery is an interface that covers all supported node query combinations. The contract supports a fluent interface to make query specifications more succinct.
type NodeSet ¶
NodeSet is a mapped index of Node instances and their ID fields.
func EmptyNodeSet ¶
func EmptyNodeSet() NodeSet
func MergeNodeSets ¶
func NewNodeSet ¶
NewNodeSet returns a new NodeSet from the given Node slice.
func SortAndSliceNodeSet ¶ added in v0.1.1
func (NodeSet) AddIfNotExists ¶
func (NodeSet) ContainingNodeKinds ¶
ContainingNodeKinds returns a new NodeSet containing only Node instances that contain any one of the given Kind instances.
func (NodeSet) Contains ¶
Contains returns true if the ID of the given Node is stored within this NodeSet.
func (NodeSet) ContainsID ¶
ContainsID returns true if the Node represented by the given ID is stored within this NodeSet.
func (NodeSet) IDBitmap ¶
func (s NodeSet) IDBitmap() cardinality.Duplex[uint64]
IDBitmap returns a new bitmap instance containing all Node ID values in this NodeSet.
func (NodeSet) KindSet ¶
func (s NodeSet) KindSet() NodeKindSet
KindSet returns a NodeKindSet constructed from the Node instances in this set.
func (NodeSet) Pick ¶
Pick returns a single Node instance from this set. Repeated calls to this function are not guaranteed to return the same Node instance.
func (*NodeSet) UnmarshalJSON ¶
type NodeUpdate ¶
func (NodeUpdate) Key ¶
func (s NodeUpdate) Key() (string, error)
type Path ¶
type Path struct {
Nodes []*Node
Edges []*Relationship
}
func AllocatePath ¶
func (Path) ContainsNode ¶
func (Path) Walk ¶
func (s Path) Walk(delegate func(start, end *Node, relationship *Relationship) bool)
func (Path) WalkReverse ¶
func (s Path) WalkReverse(delegate func(start, end *Node, relationship *Relationship) bool)
type PathSegment ¶
type PathSegment struct {
Node *Node
Trunk *PathSegment
Edge *Relationship
Branches []*PathSegment
Tag any
// contains filtered or unexported fields
}
func NewRootPathSegment ¶
func NewRootPathSegment(root *Node) *PathSegment
func (*PathSegment) Depth ¶
func (s *PathSegment) Depth() int
func (*PathSegment) Descend ¶
func (s *PathSegment) Descend(node *Node, relationship *Relationship) *PathSegment
Descend returns a PathSegment with an added edge supplied as input, to the node supplied as input. All required updates to slices, pointers, and sizes are included in this operation.
func (*PathSegment) Detach ¶
func (s *PathSegment) Detach()
func (*PathSegment) GetTrunkSegment ¶
func (s *PathSegment) GetTrunkSegment() *PathSegment
func (*PathSegment) IsCycle ¶
func (s *PathSegment) IsCycle() bool
func (*PathSegment) Path ¶
func (s *PathSegment) Path() Path
func (*PathSegment) Search ¶
func (s *PathSegment) Search(delegate func(nextSegment *PathSegment) bool) *Node
func (*PathSegment) SizeOf ¶
func (s *PathSegment) SizeOf() size.Size
func (*PathSegment) Slice ¶
func (s *PathSegment) Slice() []*PathSegment
func (*PathSegment) WalkReverse ¶
func (s *PathSegment) WalkReverse(delegate func(nextSegment *PathSegment) bool)
type PathSet ¶
type PathSet []Path
PathSet is a collection of graph traversals stored as Path instances.
func NewPathSet ¶
func (*PathSet) AddPathSet ¶
func (PathSet) ExcludeByEdgeKinds ¶
func (PathSet) FilterByEdge ¶
func (s PathSet) FilterByEdge(filter func(edge *Relationship) bool) PathSet
func (PathSet) IncludeByEdgeKinds ¶
type Properties ¶
type Properties struct {
Map map[string]any `json:"map"`
Deleted map[string]struct{} `json:"deleted"`
Modified map[string]struct{} `json:"modified"`
}
Properties is a map type that satisfies the Properties interface.
func AsProperties ¶
func AsProperties[T PropertyMap | map[String]any | map[string]any](rawStore T) *Properties
func NewProperties ¶
func NewProperties() *Properties
func NewPropertiesRed ¶
func NewPropertiesRed() *Properties
func (*Properties) Clone ¶
func (s *Properties) Clone() *Properties
func (*Properties) Delete ¶
func (s *Properties) Delete(key string) *Properties
func (*Properties) DeletedProperties ¶
func (s *Properties) DeletedProperties() []string
func (*Properties) Exists ¶
func (s *Properties) Exists(key string) bool
Exists returns true if a value exists for the given key, false otherwise.
func (*Properties) Get ¶
func (s *Properties) Get(key string) PropertyValue
Get fetches a value from the Properties by key and returns a tuple containing the value and a boolean informing the caller if the value was found. If the value was not found the value portion of the return tuple is nil.
func (*Properties) GetOrDefault ¶
func (s *Properties) GetOrDefault(key string, defaultValue any) PropertyValue
GetOrDefault fetches a value from the Properties by key. If the key is not present in the Properties this function returns the given default value instead.
func (*Properties) GetWithFallback ¶
func (s *Properties) GetWithFallback(key string, defaultValue any, fallbackKeys ...string) PropertyValue
func (*Properties) HashInto ¶ added in v0.3.0
func (s *Properties) HashInto(h *xxhash.Digest, ignoredKeys map[string]struct{}) error
HashInto returns a hash of the Properties' key-value pairs, ignoring specified keys. It marshals values using JSON and appends them to the hash stream in sorted key order.
func (*Properties) Keys ¶ added in v0.3.0
func (s *Properties) Keys(ignoredKeys map[string]struct{}) []string
Keys returns all property keys excluding those listed in ignoredKeys. The returned slice is sorted lexicographically.
func (*Properties) Len ¶
func (s *Properties) Len() int
func (*Properties) MapOrEmpty ¶
func (s *Properties) MapOrEmpty() map[string]any
func (*Properties) Merge ¶
func (s *Properties) Merge(other *Properties)
func (*Properties) ModifiedProperties ¶
func (s *Properties) ModifiedProperties() map[string]any
func (*Properties) Set ¶
func (s *Properties) Set(key string, value any) *Properties
Set sets a value within the PropertyMap.
func (*Properties) SetAll ¶
func (s *Properties) SetAll(other map[string]any) *Properties
func (*Properties) SizeOf ¶
func (s *Properties) SizeOf() size.Size
type PropertyMap ¶
type PropertyValue ¶
type PropertyValue interface {
// IsNil returns true if the property value is nil.
IsNil() bool
// Bool returns the property value as a bool along with any type negotiation error information.
Bool() (bool, error)
// Int returns the property value as an int along with any type negotiation error information.
Int() (int, error)
// Int64 returns the property value as an int64 along with any type negotiation error information.
Int64() (int64, error)
// Int64Slice returns the property value as an int64 slice along with any type negotiation error information.
Int64Slice() ([]int64, error)
// IDSlice returns the property value as a ID slice along with any type negotiation error information.
IDSlice() ([]ID, error)
//StringSlice returns the property value as a string slice along with any type negotiation error information.
StringSlice() ([]string, error)
// Uint64 returns the property value as an uint64 along with any type negotiation error information.
Uint64() (uint64, error)
// Float64 returns the property value as a float64 along with any type negotiation error information.
Float64() (float64, error)
// String returns the property value as a string along with any type negotiation error information.
String() (string, error)
// Time returns the property value as time.Time along with any type negotiation error information.
Time() (time.Time, error)
// Any returns the property value typed as any. This function may return a null reference.
Any() any
}
PropertyValue is an interface that offers type negotiation for property values to reduce the boilerplate required handle property values.
func NewPropertyResult ¶
func NewPropertyResult(key string, value any) PropertyValue
NewPropertyResult takes a bare any type and returns a generic type negotiation wrapper that adheres to the PropertyValue interface.
type Relationship ¶
type Relationship struct {
ID ID
StartID ID
EndID ID
Kind Kind
Properties *Properties
}
func NewRelationship ¶
func NewRelationship(id, startID, endID ID, properties *Properties, kind Kind) *Relationship
func PrepareRelationship ¶
func PrepareRelationship(properties *Properties, kind Kind) *Relationship
func (*Relationship) Merge ¶
func (s *Relationship) Merge(other *Relationship)
func (*Relationship) SizeOf ¶
func (s *Relationship) SizeOf() size.Size
type RelationshipKindsResult ¶
type RelationshipKindsResult struct {
RelationshipTripleResult
Kind Kind
}
type RelationshipQuery ¶
type RelationshipQuery interface {
// Filter applies the given criteria to this query.
Filter(criteria Criteria) RelationshipQuery
// Filterf applies the given criteria provider function to this query.
Filterf(criteriaDelegate CriteriaProvider) RelationshipQuery
// Update replaces the properties of all candidate relationships that matches the query criteria with the
// given properties
Update(properties *Properties) error
// Delete deletes any candidate relationships that match the query criteria
Delete() error
// OrderBy sets the OrderBy clause of the RelationshipQuery.
OrderBy(criteria ...Criteria) RelationshipQuery
// Offset sets an offset for the result set of the query. Using this function will enforce order on the result set.
Offset(skip int) RelationshipQuery
// Limit sets a maximum number of results to collect from the database.
Limit(skip int) RelationshipQuery
// Count completes the query and returns a tuple containing the count of results that were addressed by the
// database and any error encountered during execution.
Count() (int64, error)
// First completes the query and returns the result and any error encountered during execution.
First() (*Relationship, error)
// Query completes the query and hands the raw result to the given delegate for unmarshalling
Query(delegate func(results Result) error, finalCriteria ...Criteria) error
// Fetch completes the query and captures a cursor for iterating the result set. This cursor is passed to the given
// delegate. Errors from the delegate are returned upwards as the error result of this call.
Fetch(delegate func(cursor Cursor[*Relationship]) error) error
// FetchDirection completes the query and captures a cursor for iterating through the relationship related nodes
// for the given path direction
FetchDirection(direction Direction, delegate func(cursor Cursor[DirectionalResult]) error) error
// FetchIDs completes the query and captures a cursor for iterating the result set. This cursor is passed to the given
// delegate. Errors from the delegate are returned upwards as the error result of this call.
FetchIDs(delegate func(cursor Cursor[ID]) error) error
//
FetchTriples(delegate func(cursor Cursor[RelationshipTripleResult]) error) error
//
FetchAllShortestPaths(delegate func(cursor Cursor[Path]) error) error
// FetchKinds returns the ID, Kind, Start ID and End ID of matched relationships and omits property fetching
FetchKinds(delegate func(cursor Cursor[RelationshipKindsResult]) error) error
}
RelationshipQuery is an interface that covers all supported relationship query combinations. The contract supports a fluent interface to make query specifications more succinct.
type RelationshipSet ¶
type RelationshipSet map[ID]*Relationship
RelationshipSet is a mapped index of Relationship instances and their ID fields.
func NewRelationshipSet ¶
func NewRelationshipSet(relationships ...*Relationship) RelationshipSet
NewRelationshipSet returns a new RelationshipSet from the given Relationship slice.
func (RelationshipSet) Add ¶
func (s RelationshipSet) Add(relationships ...*Relationship)
Add adds a given Relationship to the RelationshipSet.
func (RelationshipSet) AddSet ¶
func (s RelationshipSet) AddSet(other RelationshipSet)
AddSet merges all Relationships from the given RelationshipSet into this RelationshipSet.
func (RelationshipSet) Contains ¶
func (s RelationshipSet) Contains(relationship *Relationship) bool
Contains returns true if the ID of the given Relationship is stored within this RelationshipSet.
func (RelationshipSet) ContainsID ¶
func (s RelationshipSet) ContainsID(id ID) bool
ContainsID returns true if the Relationship represented by the given ID is stored within this RelationshipSet.
func (RelationshipSet) Get ¶
func (s RelationshipSet) Get(id ID) *Relationship
Get returns a Relationship from this set by its database ID.
func (RelationshipSet) IDBitmap ¶
func (s RelationshipSet) IDBitmap() cardinality.Duplex[uint64]
IDBitmap returns a new roaring64.Bitmap instance containing all Relationship ID values in this RelationshipSet.
func (RelationshipSet) Len ¶
func (s RelationshipSet) Len() int
Len returns the number of unique Relationship instances in this set.
func (RelationshipSet) Slice ¶
func (s RelationshipSet) Slice() []*Relationship
Slice returns a slice of the Relationship instances stored in this RelationshipSet.
type RelationshipUpdate ¶
type RelationshipUpdate struct {
Relationship *Relationship
IdentityProperties []string
Start *Node
StartIdentityKind Kind
StartIdentityProperties []string
End *Node
EndIdentityKind Kind
EndIdentityProperties []string
}
func (RelationshipUpdate) EndIdentityPropertiesMap ¶
func (s RelationshipUpdate) EndIdentityPropertiesMap() map[string]any
func (RelationshipUpdate) IdentityPropertiesMap ¶
func (s RelationshipUpdate) IdentityPropertiesMap() map[string]any
func (RelationshipUpdate) Key ¶
func (s RelationshipUpdate) Key() (string, error)
func (RelationshipUpdate) StartIdentityPropertiesMap ¶
func (s RelationshipUpdate) StartIdentityPropertiesMap() map[string]any
type Result ¶
type Result interface {
Next() bool
Keys() []string
Values() []any
Mapper() ValueMapper
// Scan takes a list of target any and attempts to map the next row from the result to the targets. This function
// is semantically equivalent to calling graph.ScanNextResult(...)
//
// This is Deprecated. Call the graph.ScanNextResult(...) function.
Scan(targets ...any) error
Error() error
Close()
}
func NewErrorResult ¶
type ResultIterator ¶
type ResultIterator[T any] struct { // contains filtered or unexported fields }
func (*ResultIterator[T]) Chan ¶
func (s *ResultIterator[T]) Chan() chan T
func (*ResultIterator[T]) Close ¶
func (s *ResultIterator[T]) Close()
func (*ResultIterator[T]) Error ¶
func (s *ResultIterator[T]) Error() error
type ResultMarshaller ¶
type String ¶
type String interface {
String() string
}
String represents a database-safe code-to-symbol mapping that negotiates to a string.
type ThreadSafeKindBitmap ¶
type ThreadSafeKindBitmap struct {
// contains filtered or unexported fields
}
func NewThreadSafeKindBitmap ¶
func NewThreadSafeKindBitmap() *ThreadSafeKindBitmap
func (ThreadSafeKindBitmap) Add ¶
func (s ThreadSafeKindBitmap) Add(kind Kind, value uint64)
func (ThreadSafeKindBitmap) Cardinality ¶
func (s ThreadSafeKindBitmap) Cardinality(kinds ...Kind) uint64
func (ThreadSafeKindBitmap) CheckedAdd ¶
func (s ThreadSafeKindBitmap) CheckedAdd(kind Kind, value uint64) bool
func (ThreadSafeKindBitmap) Clone ¶
func (s ThreadSafeKindBitmap) Clone() *ThreadSafeKindBitmap
func (ThreadSafeKindBitmap) Contains ¶
func (s ThreadSafeKindBitmap) Contains(kind Kind, value uint64) bool
func (ThreadSafeKindBitmap) Get ¶
func (s ThreadSafeKindBitmap) Get(kinds ...Kind) cardinality.Duplex[uint64]
func (ThreadSafeKindBitmap) Or ¶
func (s ThreadSafeKindBitmap) Or(kind Kind, other cardinality.Duplex[uint64])
type ThreadSafeNodeSet ¶
type ThreadSafeNodeSet struct {
// contains filtered or unexported fields
}
func NewThreadSafeNodeSet ¶
func NewThreadSafeNodeSet(nodeSet NodeSet) *ThreadSafeNodeSet
func (*ThreadSafeNodeSet) Add ¶
func (s *ThreadSafeNodeSet) Add(nodes ...*Node)
Add adds a given Node to the NodeSet.
func (*ThreadSafeNodeSet) AddIfNotExists ¶
func (s *ThreadSafeNodeSet) AddIfNotExists(node *Node) bool
func (*ThreadSafeNodeSet) AddSet ¶
func (s *ThreadSafeNodeSet) AddSet(set NodeSet)
AddSet merges all Nodes from the given NodeSet into this NodeSet.
func (ThreadSafeNodeSet) ContainingNodeKinds ¶
func (s ThreadSafeNodeSet) ContainingNodeKinds(kinds ...Kind) NodeSet
ContainingNodeKinds returns a new ThreadSafeNodeSet containing only Node instances that contain any one of the given Kind instances.
func (ThreadSafeNodeSet) Contains ¶
func (s ThreadSafeNodeSet) Contains(node *Node) bool
Contains returns true if the ID of the given Node is stored within this NodeSet.
func (ThreadSafeNodeSet) ContainsID ¶
func (s ThreadSafeNodeSet) ContainsID(id ID) bool
ContainsID returns true if the Node represented by the given ID is stored within this NodeSet.
func (ThreadSafeNodeSet) Copy ¶
func (s ThreadSafeNodeSet) Copy() ThreadSafeNodeSet
Copy returns a shallow copy of this set.
func (ThreadSafeNodeSet) Get ¶
func (s ThreadSafeNodeSet) Get(id ID) *Node
Get returns a Node from this set by its database ID.
func (ThreadSafeNodeSet) IDBitmap ¶
func (s ThreadSafeNodeSet) IDBitmap() cardinality.Duplex[uint64]
IDBitmap returns a new roaring64.Bitmap instance containing all Node ID values in this NodeSet.
func (ThreadSafeNodeSet) IDs ¶
func (s ThreadSafeNodeSet) IDs() []ID
IDs returns a slice of database IDs for all nodes in the set.
func (ThreadSafeNodeSet) KindSet ¶
func (s ThreadSafeNodeSet) KindSet() NodeKindSet
KindSet returns a NodeKindSet constructed from the Node instances in this set.
func (ThreadSafeNodeSet) Len ¶
func (s ThreadSafeNodeSet) Len() int
Len returns the number of unique Node instances in this set.
func (ThreadSafeNodeSet) Pick ¶
func (s ThreadSafeNodeSet) Pick() *Node
Pick returns a single Node instance from this set. Repeated calls to this function are not guaranteed to return the same Node instance.
func (*ThreadSafeNodeSet) Remove ¶
func (s *ThreadSafeNodeSet) Remove(id ID)
Remove removes a Node from this set by its database ID.
func (ThreadSafeNodeSet) Slice ¶
func (s ThreadSafeNodeSet) Slice() []*Node
Slice returns a slice of the Node instances stored in this NodeSet.
type Transaction ¶
type Transaction interface {
// WithGraph scopes the transaction to a specific graph. If the driver for the transaction does not support
// multiple graphs the resulting transaction will target the default graph instead and this call becomes a no-op.
WithGraph(graphSchema Graph) Transaction
// CreateNode creates a new Node in the database and returns the creation as a NodeResult.
CreateNode(properties *Properties, kinds ...Kind) (*Node, error)
// UpdateNode updates a Node in the database with the given Node by ID. UpdateNode will not create missing Node
// entries in the database. Use CreateNode first to create a new Node.
UpdateNode(node *Node) error
// Nodes creates a new NodeQuery and returns it.
Nodes() NodeQuery
// CreateRelationshipByIDs creates a new Relationship from the start Node to the end Node with the given Kind and
// Properties and returns the creation as a RelationshipResult.
CreateRelationshipByIDs(startNodeID, endNodeID ID, kind Kind, properties *Properties) (*Relationship, error)
// UpdateRelationship updates a Relationship in the database with the given Relationship by ID. UpdateRelationship
// will not create missing Relationship entries in the database. Use CreateRelationship first to create a new
// Relationship.
UpdateRelationship(relationship *Relationship) error
// Relationships creates a new RelationshipQuery and returns it.
Relationships() RelationshipQuery
// Raw allows a user to pass raw queries directly to the database without translation.
Raw(query string, parameters map[string]any) Result
// Query allows a user to execute a given cypher query that will be translated to the target database.
Query(query string, parameters map[string]any) Result
// Commit calls to commit this transaction right away.
Commit() error
// GraphQueryMemoryLimit returns the graph query memory limit of
GraphQueryMemoryLimit() size.Size
}
Transaction is an interface that contains all operations that may be executed against a DAWGS driver. DAWGS drivers are expected to support all Transaction operations in-transaction.
type TransactionConfig ¶
TransactionConfig is a generic configuration that may apply to all supported databases.
type TransactionDelegate ¶
type TransactionDelegate func(tx Transaction) error
TransactionDelegate represents a transactional database context actor. Errors returned from a TransactionDelegate result in the rollback of write enabled transactions. Successful execution of a TransactionDelegate (nil error return value) results in a transactional commit of work done within the TransactionDelegate.
type TransactionOption ¶
type TransactionOption func(config *TransactionConfig)
TransactionOption is a function that represents a configuration setting for the underlying database transaction.
type Tree ¶
type Tree struct {
Root *PathSegment
}
type ValueMapper ¶
type ValueMapper struct {
// contains filtered or unexported fields
}
func NewValueMapper ¶
func NewValueMapper(mappers ...MapFunc) ValueMapper
func (ValueMapper) Map ¶ added in v0.1.4
func (s ValueMapper) Map(value, target any) bool
func (ValueMapper) MapAll ¶ added in v0.1.4
func (s ValueMapper) MapAll(values, targets []any) bool