sqlite

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundle

type Bundle struct {
	ID                 string
	TrustDomainID      string
	Data               []byte
	Digest             []byte
	Signature          []byte
	SigningCertificate []byte
	CreatedAt          time.Time
	UpdatedAt          time.Time
}

func (Bundle) ToEntity

func (b Bundle) ToEntity() (*entity.Bundle, error)

type CreateBundleParams

type CreateBundleParams struct {
	ID                 string
	Data               []byte
	Digest             []byte
	Signature          []byte
	SigningCertificate []byte
	TrustDomainID      string
}

type CreateJoinTokenParams

type CreateJoinTokenParams struct {
	ID            string
	Token         string
	ExpiresAt     time.Time
	TrustDomainID string
}

type CreateRelationshipParams

type CreateRelationshipParams struct {
	ID                  string
	TrustDomainAID      string
	TrustDomainBID      string
	TrustDomainAConsent string
	TrustDomainBConsent string
	CreatedAt           time.Time
	UpdatedAt           time.Time
}

type CreateTrustDomainParams

type CreateTrustDomainParams struct {
	ID          string
	Name        string
	Description sql.NullString
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Datastore

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

Datastore is a SQL database accessor that provides convenient methods to perform CRUD operations for Galadriel entities. It implements the Datastore interface.

func NewDatastore

func NewDatastore(connString string) (*Datastore, error)

NewDatastore creates a new instance of a Datastore object that connects to an SQLite database parsing the connString. The connString should be a file path to the SQLite database file.

func (*Datastore) Close

func (d *Datastore) Close() error

func (*Datastore) CreateJoinToken

func (d *Datastore) CreateJoinToken(ctx context.Context, req *entity.JoinToken) (*entity.JoinToken, error)

func (*Datastore) CreateOrUpdateBundle

func (d *Datastore) CreateOrUpdateBundle(ctx context.Context, req *entity.Bundle) (*entity.Bundle, error)

func (*Datastore) CreateOrUpdateRelationship

func (d *Datastore) CreateOrUpdateRelationship(ctx context.Context, req *entity.Relationship) (*entity.Relationship, error)

func (*Datastore) CreateOrUpdateTrustDomain

func (d *Datastore) CreateOrUpdateTrustDomain(ctx context.Context, req *entity.TrustDomain) (*entity.TrustDomain, error)

CreateOrUpdateTrustDomain creates or updates the given TrustDomain in the underlying db, based on whether the given entity has an ID, in which case, it is updated.

func (*Datastore) DeleteBundle

func (d *Datastore) DeleteBundle(ctx context.Context, bundleID uuid.UUID) error

func (*Datastore) DeleteJoinToken

func (d *Datastore) DeleteJoinToken(ctx context.Context, joinTokenID uuid.UUID) error

func (*Datastore) DeleteRelationship

func (d *Datastore) DeleteRelationship(ctx context.Context, relationshipID uuid.UUID) error

func (*Datastore) DeleteTrustDomain

func (d *Datastore) DeleteTrustDomain(ctx context.Context, trustDomainID uuid.UUID) error

func (*Datastore) FindBundleByID

func (d *Datastore) FindBundleByID(ctx context.Context, bundleID uuid.UUID) (*entity.Bundle, error)

func (*Datastore) FindBundleByTrustDomainID

func (d *Datastore) FindBundleByTrustDomainID(ctx context.Context, trustDomainID uuid.UUID) (*entity.Bundle, error)

func (*Datastore) FindJoinToken

func (d *Datastore) FindJoinToken(ctx context.Context, token string) (*entity.JoinToken, error)

func (*Datastore) FindJoinTokensByID

func (d *Datastore) FindJoinTokensByID(ctx context.Context, joinTokenID uuid.UUID) (*entity.JoinToken, error)

func (*Datastore) FindJoinTokensByTrustDomainID

func (d *Datastore) FindJoinTokensByTrustDomainID(ctx context.Context, trustDomainID uuid.UUID) ([]*entity.JoinToken, error)

func (*Datastore) FindRelationshipByID

func (d *Datastore) FindRelationshipByID(ctx context.Context, relationshipID uuid.UUID) (*entity.Relationship, error)

func (*Datastore) FindRelationshipsByTrustDomainID

func (d *Datastore) FindRelationshipsByTrustDomainID(ctx context.Context, trustDomainID uuid.UUID) ([]*entity.Relationship, error)

func (*Datastore) FindTrustDomainByID

func (d *Datastore) FindTrustDomainByID(ctx context.Context, trustDomainID uuid.UUID) (*entity.TrustDomain, error)

func (*Datastore) FindTrustDomainByName

func (d *Datastore) FindTrustDomainByName(ctx context.Context, name spiffeid.TrustDomain) (*entity.TrustDomain, error)

func (*Datastore) ListBundles

func (d *Datastore) ListBundles(ctx context.Context) ([]*entity.Bundle, error)

func (*Datastore) ListJoinTokens

func (d *Datastore) ListJoinTokens(ctx context.Context) ([]*entity.JoinToken, error)

func (*Datastore) ListRelationships

func (d *Datastore) ListRelationships(ctx context.Context, criteria *criteria.ListRelationshipsCriteria) ([]*entity.Relationship, error)

func (*Datastore) ListTrustDomains

func (d *Datastore) ListTrustDomains(ctx context.Context) ([]*entity.TrustDomain, error)

func (*Datastore) UpdateJoinToken

func (d *Datastore) UpdateJoinToken(ctx context.Context, joinTokenID uuid.UUID, used bool) (*entity.JoinToken, error)

type FindRelationshipsByTrustDomainIDParams

type FindRelationshipsByTrustDomainIDParams struct {
	TrustDomainAID string
	TrustDomainBID string
}

type JoinToken

type JoinToken struct {
	ID            string
	TrustDomainID string
	Token         string
	Used          bool
	ExpiresAt     time.Time
	CreatedAt     time.Time
	UpdatedAt     time.Time
}

func (JoinToken) ToEntity

func (jt JoinToken) ToEntity() (*entity.JoinToken, error)

type Querier

type Querier interface {
	CreateBundle(ctx context.Context, arg CreateBundleParams) (Bundle, error)
	CreateJoinToken(ctx context.Context, arg CreateJoinTokenParams) (JoinToken, error)
	CreateRelationship(ctx context.Context, arg CreateRelationshipParams) (Relationship, error)
	CreateTrustDomain(ctx context.Context, arg CreateTrustDomainParams) (TrustDomain, error)
	DeleteBundle(ctx context.Context, id string) error
	DeleteJoinToken(ctx context.Context, id string) error
	DeleteRelationship(ctx context.Context, id string) error
	DeleteTrustDomain(ctx context.Context, id string) error
	FindBundleByID(ctx context.Context, id string) (Bundle, error)
	FindBundleByTrustDomainID(ctx context.Context, trustDomainID string) (Bundle, error)
	FindJoinToken(ctx context.Context, token string) (JoinToken, error)
	FindJoinTokenByID(ctx context.Context, id string) (JoinToken, error)
	FindJoinTokensByTrustDomainID(ctx context.Context, trustDomainID string) ([]JoinToken, error)
	FindRelationshipByID(ctx context.Context, id string) (Relationship, error)
	FindRelationshipsByTrustDomainID(ctx context.Context, arg FindRelationshipsByTrustDomainIDParams) ([]Relationship, error)
	FindTrustDomainByID(ctx context.Context, id string) (TrustDomain, error)
	FindTrustDomainByName(ctx context.Context, name string) (TrustDomain, error)
	ListBundles(ctx context.Context) ([]Bundle, error)
	ListJoinTokens(ctx context.Context) ([]JoinToken, error)
	ListTrustDomains(ctx context.Context) ([]TrustDomain, error)
	UpdateBundle(ctx context.Context, arg UpdateBundleParams) (Bundle, error)
	UpdateJoinToken(ctx context.Context, arg UpdateJoinTokenParams) (JoinToken, error)
	UpdateRelationship(ctx context.Context, arg UpdateRelationshipParams) (Relationship, error)
	UpdateTrustDomain(ctx context.Context, arg UpdateTrustDomainParams) (TrustDomain, error)
}

type Queries

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

func New

func New(db DBTX) *Queries

func Prepare

func Prepare(ctx context.Context, db DBTX) (*Queries, error)

func (*Queries) Close

func (q *Queries) Close() error

func (*Queries) CreateBundle

func (q *Queries) CreateBundle(ctx context.Context, arg CreateBundleParams) (Bundle, error)

func (*Queries) CreateJoinToken

func (q *Queries) CreateJoinToken(ctx context.Context, arg CreateJoinTokenParams) (JoinToken, error)

func (*Queries) CreateRelationship

func (q *Queries) CreateRelationship(ctx context.Context, arg CreateRelationshipParams) (Relationship, error)

func (*Queries) CreateTrustDomain

func (q *Queries) CreateTrustDomain(ctx context.Context, arg CreateTrustDomainParams) (TrustDomain, error)

func (*Queries) DeleteBundle

func (q *Queries) DeleteBundle(ctx context.Context, id string) error

func (*Queries) DeleteJoinToken

func (q *Queries) DeleteJoinToken(ctx context.Context, id string) error

func (*Queries) DeleteRelationship

func (q *Queries) DeleteRelationship(ctx context.Context, id string) error

func (*Queries) DeleteTrustDomain

func (q *Queries) DeleteTrustDomain(ctx context.Context, id string) error

func (*Queries) FindBundleByID

func (q *Queries) FindBundleByID(ctx context.Context, id string) (Bundle, error)

func (*Queries) FindBundleByTrustDomainID

func (q *Queries) FindBundleByTrustDomainID(ctx context.Context, trustDomainID string) (Bundle, error)

func (*Queries) FindJoinToken

func (q *Queries) FindJoinToken(ctx context.Context, token string) (JoinToken, error)

func (*Queries) FindJoinTokenByID

func (q *Queries) FindJoinTokenByID(ctx context.Context, id string) (JoinToken, error)

func (*Queries) FindJoinTokensByTrustDomainID

func (q *Queries) FindJoinTokensByTrustDomainID(ctx context.Context, trustDomainID string) ([]JoinToken, error)

func (*Queries) FindRelationshipByID

func (q *Queries) FindRelationshipByID(ctx context.Context, id string) (Relationship, error)

func (*Queries) FindRelationshipsByTrustDomainID

func (q *Queries) FindRelationshipsByTrustDomainID(ctx context.Context, arg FindRelationshipsByTrustDomainIDParams) ([]Relationship, error)

func (*Queries) FindTrustDomainByID

func (q *Queries) FindTrustDomainByID(ctx context.Context, id string) (TrustDomain, error)

func (*Queries) FindTrustDomainByName

func (q *Queries) FindTrustDomainByName(ctx context.Context, name string) (TrustDomain, error)

func (*Queries) ListBundles

func (q *Queries) ListBundles(ctx context.Context) ([]Bundle, error)

func (*Queries) ListJoinTokens

func (q *Queries) ListJoinTokens(ctx context.Context) ([]JoinToken, error)

func (*Queries) ListTrustDomains

func (q *Queries) ListTrustDomains(ctx context.Context) ([]TrustDomain, error)

func (*Queries) UpdateBundle

func (q *Queries) UpdateBundle(ctx context.Context, arg UpdateBundleParams) (Bundle, error)

func (*Queries) UpdateJoinToken

func (q *Queries) UpdateJoinToken(ctx context.Context, arg UpdateJoinTokenParams) (JoinToken, error)

func (*Queries) UpdateRelationship

func (q *Queries) UpdateRelationship(ctx context.Context, arg UpdateRelationshipParams) (Relationship, error)

func (*Queries) UpdateTrustDomain

func (q *Queries) UpdateTrustDomain(ctx context.Context, arg UpdateTrustDomainParams) (TrustDomain, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type Relationship

type Relationship struct {
	ID                  string
	TrustDomainAID      string
	TrustDomainBID      string
	TrustDomainAConsent string
	TrustDomainBConsent string
	CreatedAt           time.Time
	UpdatedAt           time.Time
}

func (Relationship) ToEntity

func (r Relationship) ToEntity() (*entity.Relationship, error)

type TrustDomain

type TrustDomain struct {
	ID          string
	Name        string
	Description sql.NullString
	CreatedAt   time.Time
	UpdatedAt   time.Time
}

func (TrustDomain) ToEntity

func (td TrustDomain) ToEntity() (*entity.TrustDomain, error)

type UpdateBundleParams

type UpdateBundleParams struct {
	Data               []byte
	Digest             []byte
	Signature          []byte
	SigningCertificate []byte
	ID                 string
}

type UpdateJoinTokenParams

type UpdateJoinTokenParams struct {
	Used bool
	ID   string
}

type UpdateRelationshipParams

type UpdateRelationshipParams struct {
	TrustDomainAConsent string
	TrustDomainBConsent string
	ID                  string
}

type UpdateTrustDomainParams

type UpdateTrustDomainParams struct {
	Description sql.NullString
	ID          string
}

Jump to

Keyboard shortcuts

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