sql

package
v0.10.0-alpha.0 Latest Latest
Warning

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

Go to latest
Published: Sep 27, 2022 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	//go:embed migrations/sql/*.sql
	Migrations embed.FS
)

Functions

This section is empty.

Types

type Persister

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

func NewPersister

func NewPersister(ctx context.Context, 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.RelationTuple) error

func (*Persister) GetRelationTuples

func (*Persister) InsertRelationTuple

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

func (*Persister) MapStringsToUUIDs

func (p *Persister) MapStringsToUUIDs(ctx context.Context, s ...string) ([]uuid.UUID, error)

func (*Persister) MapUUIDsToStrings

func (p *Persister) MapUUIDsToStrings(ctx context.Context, u ...uuid.UUID) ([]string, error)

func (*Persister) NetworkID

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

func (*Persister) QueryWithNetwork

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

func (*Persister) TransactRelationTuples

func (p *Persister) TransactRelationTuples(ctx context.Context, ins []*relationtuple.RelationTuple, del []*relationtuple.RelationTuple) error

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.RelationTuple) 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"`
	Namespace           string         `db:"namespace"`
	Object              uuid.UUID      `db:"object"`
	Relation            string         `db:"relation"`
	SubjectID           uuid.NullUUID  `db:"subject_id"`
	SubjectSetNamespace sql.NullString `db:"subject_set_namespace"`
	SubjectSetObject    uuid.NullUUID  `db:"subject_set_object"`
	SubjectSetRelation  sql.NullString `db:"subject_set_relation"`
	CommitTime          time.Time      `db:"commit_time"`
}

func (*RelationTuple) FromInternal

func (r *RelationTuple) FromInternal(ctx context.Context, p *Persister, rt *relationtuple.RelationTuple) error

func (RelationTuple) TableName

func (RelationTuple) TableName() string

type UUIDMapping

type UUIDMapping struct {
	ID                   uuid.UUID `db:"id"`
	StringRepresentation string    `db:"string_representation"`
}

func (UUIDMapping) TableName

func (UUIDMapping) TableName() string

type UUIDMappings

type UUIDMappings []*UUIDMapping

func (UUIDMappings) TableName

func (UUIDMappings) TableName() string

Directories

Path Synopsis
migrations

Jump to

Keyboard shortcuts

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