sql

package
v0.8.0-alpha.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 10, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewMigrationBox

func NewMigrationBox(c *pop.Connection, logger *logrusx.Logger, tracer *tracing.Tracer) (*popx.MigrationBox, error)

Types

type Persister

type Persister struct {
	// contains filtered or unexported fields
}

func NewPersister

func NewPersister(reg dependencies, nid uuid.UUID) (*Persister, error)

func (*Persister) Connection

func (p *Persister) Connection(ctx context.Context) *pop.Connection

func (*Persister) CreateWithNetwork

func (p *Persister) CreateWithNetwork(ctx context.Context, v interface{}) error

func (*Persister) DeleteAllRelationTuples

func (p *Persister) DeleteAllRelationTuples(ctx context.Context, query *relationtuple.RelationQuery) error

func (*Persister) DeleteRelationTuples

func (p *Persister) DeleteRelationTuples(ctx context.Context, rs ...*relationtuple.InternalRelationTuple) error

func (*Persister) GetNamespaceByID

func (p *Persister) GetNamespaceByID(ctx context.Context, id int32) (*namespace.Namespace, error)

func (*Persister) GetNamespaceByName

func (p *Persister) GetNamespaceByName(ctx context.Context, name string) (*namespace.Namespace, error)

func (*Persister) GetRelationTuples

func (*Persister) InsertRelationTuple

func (p *Persister) InsertRelationTuple(ctx context.Context, rel *relationtuple.InternalRelationTuple) error

func (*Persister) NetworkID

func (p *Persister) NetworkID(_ context.Context) uuid.UUID

func (*Persister) QueryWithNetwork

func (p *Persister) QueryWithNetwork(ctx context.Context) *pop.Query

func (*Persister) TransactRelationTuples

func (*Persister) Transaction

func (p *Persister) Transaction(ctx context.Context, f func(ctx context.Context, c *pop.Connection) error) error

func (*Persister) WriteRelationTuples

func (p *Persister) WriteRelationTuples(ctx context.Context, rs ...*relationtuple.InternalRelationTuple) error

type RelationTuple

type RelationTuple struct {
	// An ID field is required to make pop happy. The actual ID is a composite primary key.
	ID                    uuid.UUID      `db:"shard_id"`
	NetworkID             uuid.UUID      `db:"nid"`
	NamespaceID           int32          `db:"namespace_id"`
	Object                string         `db:"object"`
	Relation              string         `db:"relation"`
	SubjectID             sql.NullString `db:"subject_id"`
	SubjectSetNamespaceID sql.NullInt32  `db:"subject_set_namespace_id"`
	SubjectSetObject      sql.NullString `db:"subject_set_object"`
	SubjectSetRelation    sql.NullString `db:"subject_set_relation"`
	CommitTime            time.Time      `db:"commit_time"`
}

func (*RelationTuple) FromInternal

func (RelationTuple) TableName

func (RelationTuple) TableName(_ context.Context) string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL