Documentation
¶
Index ¶
- Constants
- func IsPostgreSQLGraph(db graph.Database) bool
- func NewPool(connectionString string) (*pgxpool.Pool, error)
- func NewValueMapper(ctx context.Context, kindMapper KindMapper) graph.ValueMapper
- func OptionSetQueryExecMode(queryExecMode pgx.QueryExecMode) graph.TransactionOption
- type Config
- type Driver
- func (s *Driver) AssertSchema(ctx context.Context, schema graph.Schema) error
- func (s *Driver) BatchOperation(ctx context.Context, batchDelegate graph.BatchDelegate) error
- func (s *Driver) Close(ctx context.Context) error
- func (s *Driver) FetchKinds(_ context.Context) (graph.Kinds, error)
- func (s *Driver) FetchSchema(ctx context.Context) (graph.Schema, error)
- func (s *Driver) KindMapper() KindMapper
- func (s *Driver) RefreshKinds(ctx context.Context) error
- func (s *Driver) Run(ctx context.Context, query string, parameters map[string]any) error
- func (s *Driver) SetBatchWriteSize(size int)
- func (s *Driver) SetDefaultGraph(ctx context.Context, graphSchema graph.Graph) error
- func (s *Driver) SetWriteFlushSize(size int)
- type Int2ArrayEncoder
- type IterationOptions
- type KindMapper
- type NodeUpsertParameters
- type QueryHook
- type QueryHookOptions
- type QueryPathInspector
- type RelationshipUpdateByParameters
- func (s *RelationshipUpdateByParameters) Append(ctx context.Context, update *sql.RelationshipUpdate, ...) error
- func (s *RelationshipUpdateByParameters) AppendAll(ctx context.Context, updates *sql.RelationshipUpdateBatch, ...) error
- func (s *RelationshipUpdateByParameters) Format(graphTarget model.Graph) []any
- type SQLState
- type SchemaManager
- func (s *SchemaManager) AssertDefaultGraph(ctx context.Context, schema graph.Graph) error
- func (s *SchemaManager) AssertGraph(tx graph.Transaction, schema graph.Graph) (model.Graph, error)
- func (s *SchemaManager) AssertKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)
- func (s *SchemaManager) AssertSchema(ctx context.Context, schema graph.Schema) error
- func (s *SchemaManager) DefaultGraph() (model.Graph, bool)
- func (s *SchemaManager) Fetch(ctx context.Context) error
- func (s *SchemaManager) GetKindIDsByKind() map[int16]graph.Kind
- func (s *SchemaManager) MapKind(ctx context.Context, kind graph.Kind) (int16, error)
- func (s *SchemaManager) MapKindID(ctx context.Context, kindID int16) (graph.Kind, error)
- func (s *SchemaManager) MapKindIDs(ctx context.Context, kindIDs []int16) (graph.Kinds, error)
- func (s *SchemaManager) MapKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)
- func (s *SchemaManager) ReadTransaction(ctx context.Context, txDelegate graph.TransactionDelegate, ...) error
- func (s *SchemaManager) SetDefaultGraph(ctx context.Context, schema graph.Graph) error
- func (s *SchemaManager) WriteTransaction(ctx context.Context, txDelegate graph.TransactionDelegate, ...) error
Constants ¶
View Source
const (
DriverName = "pg"
)
Variables ¶
This section is empty.
Functions ¶
func IsPostgreSQLGraph ¶
func NewValueMapper ¶
func NewValueMapper(ctx context.Context, kindMapper KindMapper) graph.ValueMapper
func OptionSetQueryExecMode ¶
func OptionSetQueryExecMode(queryExecMode pgx.QueryExecMode) graph.TransactionOption
Types ¶
type Config ¶
type Config struct {
Options pgx.TxOptions
QueryExecMode pgx.QueryExecMode
QueryResultFormats pgx.QueryResultFormats
BatchWriteSize int
}
type Driver ¶
type Driver struct {
*SchemaManager
// contains filtered or unexported fields
}
func (*Driver) AssertSchema ¶
func (*Driver) BatchOperation ¶
func (*Driver) FetchSchema ¶
func (*Driver) KindMapper ¶
func (s *Driver) KindMapper() KindMapper
func (*Driver) SetBatchWriteSize ¶
func (*Driver) SetDefaultGraph ¶
func (*Driver) SetWriteFlushSize ¶
type Int2ArrayEncoder ¶
type Int2ArrayEncoder struct {
// contains filtered or unexported fields
}
func (*Int2ArrayEncoder) Encode ¶
func (s *Int2ArrayEncoder) Encode(values []int16) string
type IterationOptions ¶
type IterationOptions interface {
Once()
}
type KindMapper ¶
type KindMapper interface {
MapKindID(ctx context.Context, kindID int16) (graph.Kind, error)
MapKindIDs(ctx context.Context, kindIDs []int16) (graph.Kinds, error)
MapKind(ctx context.Context, kind graph.Kind) (int16, error)
MapKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)
AssertKinds(ctx context.Context, kinds graph.Kinds) ([]int16, error)
}
func KindMapperFromGraphDatabase ¶
func KindMapperFromGraphDatabase(graphDB graph.Database) (KindMapper, error)
type NodeUpsertParameters ¶
type NodeUpsertParameters struct {
IDFutures []*sql.Future[graph.ID]
KindIDSlices []string
Properties []pgtype.JSONB
}
func NewNodeUpsertParameters ¶
func NewNodeUpsertParameters(size int) *NodeUpsertParameters
func (*NodeUpsertParameters) Append ¶
func (s *NodeUpsertParameters) Append(ctx context.Context, update *sql.NodeUpdate, schemaManager *SchemaManager, kindIDEncoder Int2ArrayEncoder) error
func (*NodeUpsertParameters) AppendAll ¶
func (s *NodeUpsertParameters) AppendAll(ctx context.Context, updates *sql.NodeUpdateBatch, schemaManager *SchemaManager, kindIDEncoder Int2ArrayEncoder) error
type QueryHook ¶
type QueryHook interface {
OnStatementMatch(statement string) QueryHookOptions
OnStatementRegex(re *regexp.Regexp) QueryHookOptions
}
type QueryHookOptions ¶
type QueryHookOptions interface {
Trace() IterationOptions
}
type QueryPathInspector ¶
type QueryPathInspector interface {
Hook() QueryHook
}
func Inspector ¶
func Inspector() QueryPathInspector
type RelationshipUpdateByParameters ¶
type RelationshipUpdateByParameters struct {
StartIDs []graph.ID
EndIDs []graph.ID
KindIDs []int16
Properties []pgtype.JSONB
}
func NewRelationshipUpdateByParameters ¶
func NewRelationshipUpdateByParameters(size int) *RelationshipUpdateByParameters
func (*RelationshipUpdateByParameters) Append ¶
func (s *RelationshipUpdateByParameters) Append(ctx context.Context, update *sql.RelationshipUpdate, schemaManager *SchemaManager) error
func (*RelationshipUpdateByParameters) AppendAll ¶
func (s *RelationshipUpdateByParameters) AppendAll(ctx context.Context, updates *sql.RelationshipUpdateBatch, schemaManager *SchemaManager) error
type SQLState ¶
type SQLState string
const (
StateObjectDoesNotExist SQLState = "42704"
)
func (SQLState) ErrorMatches ¶
type SchemaManager ¶
type SchemaManager struct {
// contains filtered or unexported fields
}
func NewSchemaManager ¶
func NewSchemaManager(pool *pgxpool.Pool, graphQueryMemoryLimit size.Size) *SchemaManager
func (*SchemaManager) AssertDefaultGraph ¶
func (*SchemaManager) AssertGraph ¶
func (s *SchemaManager) AssertGraph(tx graph.Transaction, schema graph.Graph) (model.Graph, error)
func (*SchemaManager) AssertKinds ¶
func (*SchemaManager) AssertSchema ¶
func (*SchemaManager) DefaultGraph ¶
func (s *SchemaManager) DefaultGraph() (model.Graph, bool)
func (*SchemaManager) GetKindIDsByKind ¶
func (s *SchemaManager) GetKindIDsByKind() map[int16]graph.Kind
func (*SchemaManager) MapKindIDs ¶
func (*SchemaManager) ReadTransaction ¶
func (s *SchemaManager) ReadTransaction(ctx context.Context, txDelegate graph.TransactionDelegate, options ...graph.TransactionOption) error
func (*SchemaManager) SetDefaultGraph ¶
func (*SchemaManager) WriteTransaction ¶
func (s *SchemaManager) WriteTransaction(ctx context.Context, txDelegate graph.TransactionDelegate, options ...graph.TransactionOption) error
Source Files
¶
Click to show internal directories.
Click to hide internal directories.