store

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 11, 2026 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package store implements a repository for reference values, endorsements and trust anchors extracted from CoRIMs. Stored values can then be queried and retrieved. The repository is implemented on top of an SQL Database Management System (sqlite3, PostgreSQL, and MariaDB/MySQL are supported).

A new Store is created using configuration that contains database connection settings and options that determine the behavior of the store:

cfg := store.NewConfig(
    "sqlite3", "file::memory:", // database connection settings
    store.OptionRequireLabel, // require non-empty labels for added values
    store.OptionSHA256, // use SHA256 for internal hashes
)

repo, err := store.Open(context.Background(), cfg)
if err != nil {
    return err
}

If the database has not yet been initialized, this can be done via the Store object:

if err := repo.Init(); err != nil {
    return err
}

This only needs to be done once for a new database if it has not been initialized by other means (e.g. via CLI).

The store can be populated using CBOR-encoded CoRIMs:

bytes, err := os.ReadFile("sample/corim/unsigned-cca-ta.cbor")
if err != nil {
    return err
}

if err := repo.AddBytes(bytes, "mylabel", true); err != nil {
    return err
}

The label provides a "namespace" for added values. It can be omitted by specifying an empty string, unless the store was opened with `store.OptionRequireLabel`. The last boolean argument indicates whether the added values should be "activated" making them available to verifiers.

Parsed CoRIMs can also be added:

uc, err := corim.UnmarshalAndValidateUnsignedCorimFromCBOR(bytes)
if err != nil {
    return err
}

err := repo.AddCoRIM(uc, sha256.Sum256(bytes), "mylabel", true);
if err != nil {
    return err
}

Both signed and unsigned CoRIMs are supported, however signature verification of signed CoRIMs is currently unimplemented, and so the store must be opened with `option.Insecure` to allow signed CoRIMs to be added.

Verifiers can retrieve endorsements from the store using an Environment and the label under which the values where added:

env := comid.Environment{
        Class: &comid.Class{Vendor: "ACME Inc."},
}

refVals, err := repo.GetActiveValueTriples(&env, "mylabel", true)
if err != nil {
    return err
}

The final boolean argument indicates whether the Environment will be matched exactly (parameters unset in the environment must also be unset in the store). Only triples that active and within their validity period (for those that has it) will be returned. There an analogous `GetActiveKeyTriples()` to retrieve trust anchors.

`GetActiveKeyTriples()` and `GetActiveValueTriples()` are convenience methods specifically for verifiers. They are implemented on top of a general query interface.

Contents of the store may be queried via one of the query methods using the corresponding query object.

query := store.NewValueTripleQuery().
    Label("mylabel").
    ModuleTagVerision(2).
    Environment(func(e *store.EnvironmentQuery) {
            e.Vendor("ACME Inc.").
                Model("Road Runner Trap 3000")
    }).
    ValidOn(time.Now())

triples, err := o.QueryValueTriples(query)
if err != nil {
    return err
}

Unlike the Get methods, the Query methods do not make assumptions about what is wanted; e.g. if you're only interested in active triples, you need to specify this as part of the query.

A CoSERV service wrapper for the Store allows running CoSERV queries and generating coserv.ResultSet's:

name := "Road Runner Trap 3000"
expiration := time.Duration(10 * 24 * float64(time.Hour)) // 10 days
authority, err := comid.NewCryptoKeyTaggedBytes("test")
if err != nil {
    return err
}

service := NewCoSERVService(store, expiration, authority)

cs = &coserv.Coserv{
    Profile: *profile,
    Query: coserv.Query{
        ArtifactType: coserv.ArtifactTypeReferenceValues,
        EnvironmentSelector: *coserv.NewEnvironmentSelector().
            AddClass(coserv.StatefulClass{
                Class: comid.NewClassUUID(comid.UUID{
                    0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
                    0x80, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07,
                }),
                Measurements: comid.NewMeasurements().Add(&comid.Measurement{
                    Val: comid.Mval{Name: &name},
                }),
            }),
        Timestamp:  time.Now(),
        ResultType: coserv.ResultTypeCollectedArtifacts,
    },
}

// Populate cs.ResultSet with query results
if err = service.UpdateCoSERV(cs); err != nil {
    return err
}

Index

Constants

This section is empty.

Variables

View Source
var ErrMeasuments = errors.New("cannot specify measurements for trust anchors")
View Source
var ErrNoLabel = errors.New("a label must be specified (required by store configuration)")
View Source
var ErrNoMatch = errors.New("no match found")

Functions

func ConcatExprForDialect

func ConcatExprForDialect(dialect string, tokens ...string) string

func HexExprForDialect

func HexExprForDialect(dialect, columnName string) string

func OptionForce

func OptionForce(c *Config)

func OptionInsecure

func OptionInsecure(c *Config)

func OptionMD5

func OptionMD5(c *Config)

func OptionRequireLabel

func OptionRequireLabel(c *Config)

func OptionSHA256

func OptionSHA256(c *Config)

func OptionSHA512

func OptionSHA512(c *Config)

func OptionTraceSQL

func OptionTraceSQL(c *Config)

func StringAggregatorExprForDialect

func StringAggregatorExprForDialect(dialect, columnName string) string

Types

type ClassSubquery

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

func (*ClassSubquery) ClassID

func (o *ClassSubquery) ClassID(typ string, value []byte) *ClassSubquery

func (*ClassSubquery) ClassIDBytes

func (o *ClassSubquery) ClassIDBytes(value ...[]byte) *ClassSubquery

func (*ClassSubquery) ClassIDType

func (o *ClassSubquery) ClassIDType(value ...string) *ClassSubquery

func (*ClassSubquery) Index

func (o *ClassSubquery) Index(value ...uint64) *ClassSubquery

func (*ClassSubquery) IsEmpty

func (o *ClassSubquery) IsEmpty() bool

func (*ClassSubquery) Layer

func (o *ClassSubquery) Layer(value ...uint64) *ClassSubquery

func (*ClassSubquery) Model

func (o *ClassSubquery) Model(value ...string) *ClassSubquery

func (*ClassSubquery) UpdateFromCoRIM

func (o *ClassSubquery) UpdateFromCoRIM(value *comid.Class) *ClassSubquery

func (*ClassSubquery) UpdateSelectQuery

func (o *ClassSubquery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect, exact bool)

func (*ClassSubquery) Vendor

func (o *ClassSubquery) Vendor(value ...string) *ClassSubquery

type CoSERVService

type CoSERVService struct {
	// Store used by this coserive service
	Store *Store
	// FallbackAuthority authority will be used when no other authority can
	// be established for result data.
	FallbackAuthority *comid.CryptoKey
}

CoSERVService implements CoSERV semantics on top of a Store. see https://datatracker.ietf.org/doc/draft-ietf-rats-coserv/

func NewCoSERVService

func NewCoSERVService(store *Store, authority *comid.CryptoKey) *CoSERVService

NewCoSERVService creates a new instance of the service.

func (*CoSERVService) RunQuery

func (o *CoSERVService) RunQuery(profile *eat.Profile, query *coserv.Query) (*coserv.ResultSet, error)

RunQuery runs the provided coserv.Query, returning the corresponding coserv.ResultSet. If profile is specified, only manifests whose profiles match will be considered when running the query.

func (*CoSERVService) UpdateCoSERV

func (o *CoSERVService) UpdateCoSERV(value *coserv.Coserv) error

UpdateCoSERV runs the query inside the provided coserv.Coserv object and updates its result set with the results.

type Config

type Config struct {
	db.Config

	// HashAlg specifies the hashing algorithm used for computing manifest
	// digests. This must be either md5, sha256, or sha512.
	HashAlg string
	// Insecure indicates whether insecure operations are permitted.
	Insecure bool
	// Force, when set, allows potentially unsafe operations such as
	// overwriting existing values.
	Force bool
	// RequireLabel indicates whether a label must be specified when adding
	// or looking up values from the Store.
	RequireLabel bool
}

Config contains configuration for the Store.

func NewConfig

func NewConfig(dbms, dsn string, options ...ConfigOption) *Config

func (*Config) DB

func (o *Config) DB() *db.Config

func (*Config) Validate

func (o *Config) Validate() error

func (*Config) WithOptions

func (o *Config) WithOptions(options ...ConfigOption) *Config

type ConfigOption

type ConfigOption func(c *Config)

type CryptoKeyQuery

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

func NewCryptoKeyQuery

func NewCryptoKeyQuery() *CryptoKeyQuery

func (*CryptoKeyQuery) ID

func (o *CryptoKeyQuery) ID(value ...int64) *CryptoKeyQuery

func (*CryptoKeyQuery) IsEmpty

func (o *CryptoKeyQuery) IsEmpty() bool

func (*CryptoKeyQuery) Key

func (o *CryptoKeyQuery) Key(typ string, value []byte) *CryptoKeyQuery

func (*CryptoKeyQuery) KeyBytes

func (o *CryptoKeyQuery) KeyBytes(value ...[]byte) *CryptoKeyQuery

func (*CryptoKeyQuery) KeyFromModel

func (o *CryptoKeyQuery) KeyFromModel(value ...*model.CryptoKey) *CryptoKeyQuery

func (*CryptoKeyQuery) KeyType

func (o *CryptoKeyQuery) KeyType(value ...string) *CryptoKeyQuery

func (*CryptoKeyQuery) Owner

func (o *CryptoKeyQuery) Owner(typ string, id int64) *CryptoKeyQuery

func (*CryptoKeyQuery) OwnerFromModel

func (o *CryptoKeyQuery) OwnerFromModel(value ...*model.CryptoKey) *CryptoKeyQuery

func (*CryptoKeyQuery) OwnerID

func (o *CryptoKeyQuery) OwnerID(value ...int64) *CryptoKeyQuery

func (*CryptoKeyQuery) OwnerType

func (o *CryptoKeyQuery) OwnerType(value ...string) *CryptoKeyQuery

func (*CryptoKeyQuery) Run

func (o *CryptoKeyQuery) Run(ctx context.Context, db bun.IDB) ([]*model.CryptoKey, error)

func (*CryptoKeyQuery) UpdateSelectQuery

func (o *CryptoKeyQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

type DigestQuery

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

func NewDigestQuery

func NewDigestQuery() *DigestQuery

func (*DigestQuery) AlgID

func (o *DigestQuery) AlgID(value ...uint64) *DigestQuery

func (*DigestQuery) Digest

func (o *DigestQuery) Digest(algID uint64, value []byte) *DigestQuery

func (*DigestQuery) DigestFromModel

func (o *DigestQuery) DigestFromModel(value ...*model.Digest) *DigestQuery

func (*DigestQuery) ID

func (o *DigestQuery) ID(value ...int64) *DigestQuery

func (*DigestQuery) IsEmpty

func (o *DigestQuery) IsEmpty() bool

func (*DigestQuery) Owner

func (o *DigestQuery) Owner(typ string, id int64) *DigestQuery

func (*DigestQuery) OwnerFromModel

func (o *DigestQuery) OwnerFromModel(value ...*model.Digest) *DigestQuery

func (*DigestQuery) OwnerID

func (o *DigestQuery) OwnerID(value ...int64) *DigestQuery

func (*DigestQuery) OwnerType

func (o *DigestQuery) OwnerType(value ...string) *DigestQuery

func (*DigestQuery) Run

func (o *DigestQuery) Run(ctx context.Context, db bun.IDB) ([]*model.Digest, error)

func (*DigestQuery) UpdateSelectQuery

func (o *DigestQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

func (*DigestQuery) Value

func (o *DigestQuery) Value(value ...[]byte) *DigestQuery

type EntityQuery

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

func NewEntityQuery

func NewEntityQuery() *EntityQuery

func (*EntityQuery) ID

func (o *EntityQuery) ID(value ...int64) *EntityQuery

func (*EntityQuery) IsEmpty

func (o *EntityQuery) IsEmpty() bool

func (*EntityQuery) Name

func (o *EntityQuery) Name(typ string, value string) *EntityQuery

func (*EntityQuery) NameType

func (o *EntityQuery) NameType(value ...string) *EntityQuery

func (*EntityQuery) NameValue

func (o *EntityQuery) NameValue(value ...string) *EntityQuery

func (*EntityQuery) Owner

func (o *EntityQuery) Owner(typ string, id int64) *EntityQuery

func (*EntityQuery) OwnerID

func (o *EntityQuery) OwnerID(value ...int64) *EntityQuery

func (*EntityQuery) OwnerType

func (o *EntityQuery) OwnerType(value ...string) *EntityQuery

func (*EntityQuery) Role

func (o *EntityQuery) Role(value ...string) *EntityQuery

func (*EntityQuery) Run

func (o *EntityQuery) Run(ctx context.Context, db bun.IDB) ([]*model.Entity, error)

func (*EntityQuery) URI

func (o *EntityQuery) URI(value ...string) *EntityQuery

func (*EntityQuery) UpdateSelectQuery

func (o *EntityQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

type EnvironmentQuery

type EnvironmentQuery struct {
	Exact bool
	// contains filtered or unexported fields
}

func NewEnvironmentQuery

func NewEnvironmentQuery(exact bool) *EnvironmentQuery

func (*EnvironmentQuery) Class

func (o *EnvironmentQuery) Class(updater ...func(*ClassSubquery)) *EnvironmentQuery

func (*EnvironmentQuery) ClassID

func (o *EnvironmentQuery) ClassID(typ string, value []byte) *EnvironmentQuery

func (*EnvironmentQuery) ClassIDBytes

func (o *EnvironmentQuery) ClassIDBytes(value ...[]byte) *EnvironmentQuery

func (*EnvironmentQuery) ClassIDType

func (o *EnvironmentQuery) ClassIDType(value ...string) *EnvironmentQuery

func (*EnvironmentQuery) Group

func (o *EnvironmentQuery) Group(typ string, value []byte) *EnvironmentQuery

func (*EnvironmentQuery) GroupBytes

func (o *EnvironmentQuery) GroupBytes(value ...[]byte) *EnvironmentQuery

func (*EnvironmentQuery) GroupType

func (o *EnvironmentQuery) GroupType(value ...string) *EnvironmentQuery

func (*EnvironmentQuery) ID

func (o *EnvironmentQuery) ID(value ...int64) *EnvironmentQuery

func (*EnvironmentQuery) Index

func (o *EnvironmentQuery) Index(value ...uint64) *EnvironmentQuery

func (*EnvironmentQuery) Instance

func (o *EnvironmentQuery) Instance(typ string, value []byte) *EnvironmentQuery

func (*EnvironmentQuery) InstanceBytes

func (o *EnvironmentQuery) InstanceBytes(value ...[]byte) *EnvironmentQuery

func (*EnvironmentQuery) InstanceType

func (o *EnvironmentQuery) InstanceType(value ...string) *EnvironmentQuery

func (*EnvironmentQuery) IsEmpty

func (o *EnvironmentQuery) IsEmpty() bool

func (*EnvironmentQuery) Layer

func (o *EnvironmentQuery) Layer(value ...uint64) *EnvironmentQuery

func (*EnvironmentQuery) Model

func (o *EnvironmentQuery) Model(value ...string) *EnvironmentQuery

func (*EnvironmentQuery) Run

func (o *EnvironmentQuery) Run(ctx context.Context, db bun.IDB) ([]*model.Environment, error)

func (*EnvironmentQuery) UpdateFromCoRIM

func (o *EnvironmentQuery) UpdateFromCoRIM(corimEnv *comid.Environment) error

func (*EnvironmentQuery) UpdateFromModel

func (o *EnvironmentQuery) UpdateFromModel(env *model.Environment) *EnvironmentQuery

func (*EnvironmentQuery) UpdateSelectQuery

func (o *EnvironmentQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

func (*EnvironmentQuery) Vendor

func (o *EnvironmentQuery) Vendor(value ...string) *EnvironmentQuery

type FlagQuery

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

func NewFlagQuery

func NewFlagQuery() *FlagQuery

func (*FlagQuery) CodePoint

func (o *FlagQuery) CodePoint(value ...int64) *FlagQuery

func (*FlagQuery) Flag

func (o *FlagQuery) Flag(codePoint int64, value bool) *FlagQuery

func (*FlagQuery) ID

func (o *FlagQuery) ID(value ...int64) *FlagQuery

func (*FlagQuery) IsEmpty

func (o *FlagQuery) IsEmpty() bool

func (*FlagQuery) MeasurementID

func (o *FlagQuery) MeasurementID(value ...int64) *FlagQuery

func (*FlagQuery) Run

func (o *FlagQuery) Run(ctx context.Context, db bun.IDB) ([]*model.Flag, error)

func (*FlagQuery) UpdateSelectQuery

func (o *FlagQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

func (*FlagQuery) Value

func (o *FlagQuery) Value(value bool) *FlagQuery

type IntegrityRegisterQuery

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

func NewIntegrityRegisterQuery

func NewIntegrityRegisterQuery() *IntegrityRegisterQuery

func (*IntegrityRegisterQuery) DigestAlgID

func (o *IntegrityRegisterQuery) DigestAlgID(value ...uint64) *IntegrityRegisterQuery

func (*IntegrityRegisterQuery) DigestFromModel

func (o *IntegrityRegisterQuery) DigestFromModel(value ...*model.Digest) *IntegrityRegisterQuery

func (*IntegrityRegisterQuery) DigestID

func (o *IntegrityRegisterQuery) DigestID(value ...int64) *IntegrityRegisterQuery

func (*IntegrityRegisterQuery) DigestValue

func (o *IntegrityRegisterQuery) DigestValue(algID uint64, value []byte) *IntegrityRegisterQuery

func (*IntegrityRegisterQuery) DigestsSubquery

func (o *IntegrityRegisterQuery) DigestsSubquery() *DigestQuery

func (*IntegrityRegisterQuery) ID

func (*IntegrityRegisterQuery) IndexText

func (o *IntegrityRegisterQuery) IndexText(value ...string) *IntegrityRegisterQuery

func (*IntegrityRegisterQuery) IndexUint

func (o *IntegrityRegisterQuery) IndexUint(value ...uint64) *IntegrityRegisterQuery

func (*IntegrityRegisterQuery) IsEmpty

func (o *IntegrityRegisterQuery) IsEmpty() bool

func (*IntegrityRegisterQuery) MeasurementID

func (o *IntegrityRegisterQuery) MeasurementID(value ...int64) *IntegrityRegisterQuery

func (*IntegrityRegisterQuery) Run

func (*IntegrityRegisterQuery) UpdateFromModel

func (*IntegrityRegisterQuery) UpdateSelectQuery

func (o *IntegrityRegisterQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

type KeyTripleQuery

func KeyTripleQueryFromStatefulClass

func KeyTripleQueryFromStatefulClass(statefulClass *coserv.StatefulClass) (*KeyTripleQuery, error)

func KeyTripleQueryFromStatefulGroup

func KeyTripleQueryFromStatefulGroup(statefulGroup *coserv.StatefulGroup) (*KeyTripleQuery, error)

func KeyTripleQueryFromStatefulInstance

func KeyTripleQueryFromStatefulInstance(statefulInstance *coserv.StatefulInstance) (*KeyTripleQuery, error)

func NewKeyTripleQuery

func NewKeyTripleQuery() *KeyTripleQuery

type KeyTripleQueryGroup

type KeyTripleQueryGroup = QueryGroup[*model.KeyTripleEntry, *KeyTripleQuery]

func KeyTripleQueryGroupFromCoSERV

func KeyTripleQueryGroupFromCoSERV(cq *coserv.Query) (*KeyTripleQueryGroup, error)

func NewKeyTripleQueryGroup

func NewKeyTripleQueryGroup() *KeyTripleQueryGroup

type LinkedTagQuery

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

func NewLinkedTagQuery

func NewLinkedTagQuery() *LinkedTagQuery

func (*LinkedTagQuery) ID

func (o *LinkedTagQuery) ID(value ...int64) *LinkedTagQuery

func (*LinkedTagQuery) IsEmpty

func (o *LinkedTagQuery) IsEmpty() bool

func (*LinkedTagQuery) LinkedTagID

func (o *LinkedTagQuery) LinkedTagID(typ model.TagIDType, value string) *LinkedTagQuery

func (*LinkedTagQuery) LinkedTagIDType

func (o *LinkedTagQuery) LinkedTagIDType(value ...model.TagIDType) *LinkedTagQuery

func (*LinkedTagQuery) LinkedTagIDValue

func (o *LinkedTagQuery) LinkedTagIDValue(value ...string) *LinkedTagQuery

func (*LinkedTagQuery) ModuleID

func (o *LinkedTagQuery) ModuleID(value ...int64) *LinkedTagQuery

func (*LinkedTagQuery) Run

func (o *LinkedTagQuery) Run(ctx context.Context, db bun.IDB) ([]*model.LinkedTag, error)

func (*LinkedTagQuery) TagRelation

func (o *LinkedTagQuery) TagRelation(value ...model.TagRelation) *LinkedTagQuery

func (*LinkedTagQuery) UpdateSelectQuery

func (o *LinkedTagQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

type LocatorQuery

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

func NewLocatorQuery

func NewLocatorQuery() *LocatorQuery

func (*LocatorQuery) Digests

func (o *LocatorQuery) Digests(updater func(*DigestQuery)) *LocatorQuery

func (*LocatorQuery) DigestsSubquery

func (o *LocatorQuery) DigestsSubquery() *DigestQuery

func (*LocatorQuery) Href

func (o *LocatorQuery) Href(value ...string) *LocatorQuery

func (*LocatorQuery) ID

func (o *LocatorQuery) ID(value ...int64) *LocatorQuery

func (*LocatorQuery) IsEmpty

func (o *LocatorQuery) IsEmpty() bool

func (*LocatorQuery) ManifestID

func (o *LocatorQuery) ManifestID(value ...int64) *LocatorQuery

func (*LocatorQuery) Run

func (o *LocatorQuery) Run(ctx context.Context, db bun.IDB) ([]*model.Locator, error)

func (*LocatorQuery) UpdateSelectQuery

func (o *LocatorQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

type ManifestCommonQuery

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

func (*ManifestCommonQuery) AddedAfter

func (o *ManifestCommonQuery) AddedAfter(value time.Time) *ManifestCommonQuery

func (*ManifestCommonQuery) AddedBefore

func (o *ManifestCommonQuery) AddedBefore(value time.Time) *ManifestCommonQuery

func (*ManifestCommonQuery) AddedBetween

func (o *ManifestCommonQuery) AddedBetween(lower, upper time.Time) *ManifestCommonQuery

func (*ManifestCommonQuery) IsEmpty

func (o *ManifestCommonQuery) IsEmpty() bool

func (*ManifestCommonQuery) Label

func (o *ManifestCommonQuery) Label(value ...string) *ManifestCommonQuery

func (*ManifestCommonQuery) ManifestDbID

func (o *ManifestCommonQuery) ManifestDbID(value ...int64) *ManifestCommonQuery

func (*ManifestCommonQuery) ManifestID

func (o *ManifestCommonQuery) ManifestID(typ model.TagIDType, value string) *ManifestCommonQuery

func (*ManifestCommonQuery) ManifestIDType

func (o *ManifestCommonQuery) ManifestIDType(value ...model.TagIDType) *ManifestCommonQuery

func (*ManifestCommonQuery) ManifestIDValue

func (o *ManifestCommonQuery) ManifestIDValue(value ...string) *ManifestCommonQuery

func (*ManifestCommonQuery) Profile

func (*ManifestCommonQuery) ProfileFromEAT

func (o *ManifestCommonQuery) ProfileFromEAT(values ...*eat.Profile) *ManifestCommonQuery

func (*ManifestCommonQuery) ProfileType

func (o *ManifestCommonQuery) ProfileType(value ...model.ProfileType) *ManifestCommonQuery

func (*ManifestCommonQuery) ProfileValue

func (o *ManifestCommonQuery) ProfileValue(value ...string) *ManifestCommonQuery

func (*ManifestCommonQuery) UpdateSelectQuery

func (o *ManifestCommonQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

func (*ManifestCommonQuery) ValidAfter

func (o *ManifestCommonQuery) ValidAfter(value time.Time) *ManifestCommonQuery

func (*ManifestCommonQuery) ValidBefore

func (o *ManifestCommonQuery) ValidBefore(value time.Time) *ManifestCommonQuery

func (*ManifestCommonQuery) ValidBetween

func (o *ManifestCommonQuery) ValidBetween(lower, upper time.Time) *ManifestCommonQuery

func (*ManifestCommonQuery) ValidOn

func (o *ManifestCommonQuery) ValidOn(value time.Time) *ManifestCommonQuery

type ManifestQuery

type ManifestQuery struct {
	ManifestCommonQuery
	// contains filtered or unexported fields
}

func NewManifestQuery

func NewManifestQuery() *ManifestQuery

func (*ManifestQuery) AddedAfter

func (o *ManifestQuery) AddedAfter(value time.Time) *ManifestQuery

func (*ManifestQuery) AddedBefore

func (o *ManifestQuery) AddedBefore(value time.Time) *ManifestQuery

func (*ManifestQuery) AddedBetween

func (o *ManifestQuery) AddedBetween(lower, upper time.Time) *ManifestQuery

func (*ManifestQuery) DependentRIMs

func (o *ManifestQuery) DependentRIMs(updater func(*LocatorQuery)) *ManifestQuery

func (*ManifestQuery) DependentRIMsSubquery

func (o *ManifestQuery) DependentRIMsSubquery() *LocatorQuery

func (*ManifestQuery) Digest

func (o *ManifestQuery) Digest(value ...[]byte) *ManifestQuery

func (*ManifestQuery) EntitiesSubquery

func (o *ManifestQuery) EntitiesSubquery() *EntityQuery

func (*ManifestQuery) Entity

func (o *ManifestQuery) Entity(updater func(*EntityQuery)) *ManifestQuery

func (*ManifestQuery) ID

func (o *ManifestQuery) ID(value ...int64) *ManifestQuery

func (*ManifestQuery) IsEmpty

func (o *ManifestQuery) IsEmpty() bool

func (*ManifestQuery) Label

func (o *ManifestQuery) Label(value ...string) *ManifestQuery

func (*ManifestQuery) ManifestDbID

func (o *ManifestQuery) ManifestDbID(value ...int64) *ManifestQuery

func (*ManifestQuery) ManifestID

func (o *ManifestQuery) ManifestID(typ model.TagIDType, value string) *ManifestQuery

func (*ManifestQuery) ManifestIDType

func (o *ManifestQuery) ManifestIDType(value ...model.TagIDType) *ManifestQuery

func (*ManifestQuery) ManifestIDValue

func (o *ManifestQuery) ManifestIDValue(value ...string) *ManifestQuery

func (*ManifestQuery) Profile

func (o *ManifestQuery) Profile(typ model.ProfileType, value string) *ManifestQuery

func (*ManifestQuery) ProfileFromEAT

func (o *ManifestQuery) ProfileFromEAT(value ...*eat.Profile) *ManifestQuery

func (*ManifestQuery) ProfileType

func (o *ManifestQuery) ProfileType(value ...model.ProfileType) *ManifestQuery

func (*ManifestQuery) ProfileValue

func (o *ManifestQuery) ProfileValue(value ...string) *ManifestQuery

func (*ManifestQuery) Run

func (o *ManifestQuery) Run(ctx context.Context, db bun.IDB) ([]*model.ManifestEntry, error)

func (*ManifestQuery) UpdateSelectQuery

func (o *ManifestQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

func (*ManifestQuery) ValidAfter

func (o *ManifestQuery) ValidAfter(value time.Time) *ManifestQuery

func (*ManifestQuery) ValidBefore

func (o *ManifestQuery) ValidBefore(value time.Time) *ManifestQuery

func (*ManifestQuery) ValidBetween

func (o *ManifestQuery) ValidBetween(lower, upper time.Time) *ManifestQuery

func (*ManifestQuery) ValidOn

func (o *ManifestQuery) ValidOn(value time.Time) *ManifestQuery

type MeasurementQuery

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

func NewMeasurementQuery

func NewMeasurementQuery() *MeasurementQuery

func (*MeasurementQuery) AuthorizedBy

func (o *MeasurementQuery) AuthorizedBy(typ string, value []byte) *MeasurementQuery

func (*MeasurementQuery) AuthorizedByBytes

func (o *MeasurementQuery) AuthorizedByBytes(value ...[]byte) *MeasurementQuery

func (*MeasurementQuery) AuthorizedByFromModel

func (o *MeasurementQuery) AuthorizedByFromModel(value ...*model.CryptoKey) *MeasurementQuery

func (*MeasurementQuery) AuthorizedBySubquery

func (o *MeasurementQuery) AuthorizedBySubquery() *CryptoKeyQuery

func (*MeasurementQuery) AuthorizedByType

func (o *MeasurementQuery) AuthorizedByType(value ...string) *MeasurementQuery

func (*MeasurementQuery) Digest

func (o *MeasurementQuery) Digest(algID uint64, value []byte) *MeasurementQuery

func (*MeasurementQuery) DigestAlgID

func (o *MeasurementQuery) DigestAlgID(value ...uint64) *MeasurementQuery

func (*MeasurementQuery) DigestFromModel

func (o *MeasurementQuery) DigestFromModel(value ...*model.Digest) *MeasurementQuery

func (*MeasurementQuery) DigestValue

func (o *MeasurementQuery) DigestValue(value ...[]byte) *MeasurementQuery

func (*MeasurementQuery) DigestsSubquery

func (o *MeasurementQuery) DigestsSubquery() *DigestQuery

func (*MeasurementQuery) Flag

func (o *MeasurementQuery) Flag(updater func(*FlagQuery)) *MeasurementQuery

func (*MeasurementQuery) FlagsSubquery

func (o *MeasurementQuery) FlagsSubquery() *FlagQuery

func (*MeasurementQuery) ID

func (o *MeasurementQuery) ID(value ...int64) *MeasurementQuery

func (*MeasurementQuery) IntegrityRegister

func (o *MeasurementQuery) IntegrityRegister(updater func(*IntegrityRegisterQuery)) *MeasurementQuery

func (*MeasurementQuery) IntegrityRegistersSubquery

func (o *MeasurementQuery) IntegrityRegistersSubquery() *IntegrityRegisterQuery

func (*MeasurementQuery) IsEmpty

func (o *MeasurementQuery) IsEmpty() bool

func (*MeasurementQuery) MVal

func (o *MeasurementQuery) MVal(updater func(*MeasurementValueQuery)) *MeasurementQuery

func (*MeasurementQuery) Mkey

func (o *MeasurementQuery) Mkey(typ string, value []byte) *MeasurementQuery

func (*MeasurementQuery) MkeyBytes

func (o *MeasurementQuery) MkeyBytes(value ...[]byte) *MeasurementQuery

func (*MeasurementQuery) MkeyType

func (o *MeasurementQuery) MkeyType(value ...string) *MeasurementQuery

func (*MeasurementQuery) Owner

func (o *MeasurementQuery) Owner(typ string, id int64) *MeasurementQuery

func (*MeasurementQuery) OwnerID

func (o *MeasurementQuery) OwnerID(value ...int64) *MeasurementQuery

func (*MeasurementQuery) OwnerType

func (o *MeasurementQuery) OwnerType(value ...string) *MeasurementQuery

func (*MeasurementQuery) Run

func (o *MeasurementQuery) Run(ctx context.Context, db bun.IDB) ([]*model.Measurement, error)

func (*MeasurementQuery) UpdateFromModel

func (o *MeasurementQuery) UpdateFromModel(value *model.Measurement) *MeasurementQuery

func (*MeasurementQuery) UpdateSelectQuery

func (o *MeasurementQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

func (*MeasurementQuery) ValueSubquery

func (o *MeasurementQuery) ValueSubquery() *MeasurementValueQuery

type MeasurementQueryGroup

type MeasurementQueryGroup = QueryGroup[*model.Measurement, *MeasurementQuery]

func NewMeasurementQueryGroup

func NewMeasurementQueryGroup() *MeasurementQueryGroup

type MeasurementValueQuery

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

func NewMeasurementValueQuery

func NewMeasurementValueQuery() *MeasurementValueQuery

func (*MeasurementValueQuery) AddValue

func (o *MeasurementValueQuery) AddValue(typ string, value any) error

AddValue is a non-chaining version of Value() that returns an error if the provided value has an unexpected type.

func (*MeasurementValueQuery) CodePoint

func (o *MeasurementValueQuery) CodePoint(value ...int64) *MeasurementValueQuery

func (*MeasurementValueQuery) ID

func (*MeasurementValueQuery) IsEmpty

func (o *MeasurementValueQuery) IsEmpty() bool

func (*MeasurementValueQuery) MeasurementID

func (o *MeasurementValueQuery) MeasurementID(value ...int64) *MeasurementValueQuery

func (*MeasurementValueQuery) Run

func (*MeasurementValueQuery) UpdateFromModel

func (*MeasurementValueQuery) UpdateSelectQuery

func (o *MeasurementValueQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

func (*MeasurementValueQuery) Value

func (o *MeasurementValueQuery) Value(typ string, value any) *MeasurementValueQuery

func (*MeasurementValueQuery) ValueBytes

func (o *MeasurementValueQuery) ValueBytes(value ...[]byte) *MeasurementValueQuery

func (*MeasurementValueQuery) ValueInt

func (o *MeasurementValueQuery) ValueInt(value ...int64) *MeasurementValueQuery

func (*MeasurementValueQuery) ValueText

func (o *MeasurementValueQuery) ValueText(value ...string) *MeasurementValueQuery

func (*MeasurementValueQuery) ValueType

func (o *MeasurementValueQuery) ValueType(value ...string) *MeasurementValueQuery

type ModuleTagCommonQuery

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

func (*ModuleTagCommonQuery) IsEmpty

func (o *ModuleTagCommonQuery) IsEmpty() bool

func (*ModuleTagCommonQuery) Language

func (o *ModuleTagCommonQuery) Language(value ...string) *ModuleTagCommonQuery

func (*ModuleTagCommonQuery) ModuleTagDbID

func (o *ModuleTagCommonQuery) ModuleTagDbID(value ...int64) *ModuleTagCommonQuery

func (*ModuleTagCommonQuery) ModuleTagID

func (o *ModuleTagCommonQuery) ModuleTagID(typ model.TagIDType, value string) *ModuleTagCommonQuery

func (*ModuleTagCommonQuery) ModuleTagIDType

func (o *ModuleTagCommonQuery) ModuleTagIDType(value ...model.TagIDType) *ModuleTagCommonQuery

func (*ModuleTagCommonQuery) ModuleTagIDValue

func (o *ModuleTagCommonQuery) ModuleTagIDValue(value ...string) *ModuleTagCommonQuery

func (*ModuleTagCommonQuery) ModuleTagVersion

func (o *ModuleTagCommonQuery) ModuleTagVersion(value ...uint) *ModuleTagCommonQuery

func (*ModuleTagCommonQuery) UpdateSelectQuery

func (o *ModuleTagCommonQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

type ModuleTagQuery

type ModuleTagQuery struct {
	ManifestCommonQuery
	ModuleTagCommonQuery
	// contains filtered or unexported fields
}

func NewModuleTagQuery

func NewModuleTagQuery() *ModuleTagQuery

func (*ModuleTagQuery) AddedAfter

func (o *ModuleTagQuery) AddedAfter(value time.Time) *ModuleTagQuery

func (*ModuleTagQuery) AddedBefore

func (o *ModuleTagQuery) AddedBefore(value time.Time) *ModuleTagQuery

func (*ModuleTagQuery) AddedBetween

func (o *ModuleTagQuery) AddedBetween(lower, upper time.Time) *ModuleTagQuery

func (*ModuleTagQuery) EntitiesSubquery

func (o *ModuleTagQuery) EntitiesSubquery() *EntityQuery

func (*ModuleTagQuery) Entity

func (o *ModuleTagQuery) Entity(updater func(*EntityQuery)) *ModuleTagQuery

func (*ModuleTagQuery) ID

func (o *ModuleTagQuery) ID(value ...int64) *ModuleTagQuery

func (*ModuleTagQuery) IsEmpty

func (o *ModuleTagQuery) IsEmpty() bool

func (*ModuleTagQuery) Label

func (o *ModuleTagQuery) Label(value ...string) *ModuleTagQuery

func (*ModuleTagQuery) Language

func (o *ModuleTagQuery) Language(value ...string) *ModuleTagQuery

func (*ModuleTagQuery) LinkedTag

func (o *ModuleTagQuery) LinkedTag(updater func(*LinkedTagQuery)) *ModuleTagQuery

func (*ModuleTagQuery) LinkedTagsSubquery

func (o *ModuleTagQuery) LinkedTagsSubquery() *LinkedTagQuery

func (*ModuleTagQuery) ManifestDbID

func (o *ModuleTagQuery) ManifestDbID(value ...int64) *ModuleTagQuery

func (*ModuleTagQuery) ManifestID

func (o *ModuleTagQuery) ManifestID(typ model.TagIDType, value string) *ModuleTagQuery

func (*ModuleTagQuery) ManifestIDType

func (o *ModuleTagQuery) ManifestIDType(value ...model.TagIDType) *ModuleTagQuery

func (*ModuleTagQuery) ManifestIDValue

func (o *ModuleTagQuery) ManifestIDValue(value ...string) *ModuleTagQuery

func (*ModuleTagQuery) ModuleTagDbID

func (o *ModuleTagQuery) ModuleTagDbID(value ...int64) *ModuleTagQuery

func (*ModuleTagQuery) ModuleTagID

func (o *ModuleTagQuery) ModuleTagID(typ model.TagIDType, value string) *ModuleTagQuery

func (*ModuleTagQuery) ModuleTagIDType

func (o *ModuleTagQuery) ModuleTagIDType(value ...model.TagIDType) *ModuleTagQuery

func (*ModuleTagQuery) ModuleTagIDValue

func (o *ModuleTagQuery) ModuleTagIDValue(value ...string) *ModuleTagQuery

func (*ModuleTagQuery) ModuleTagVersion

func (o *ModuleTagQuery) ModuleTagVersion(value ...uint) *ModuleTagQuery

func (*ModuleTagQuery) Profile

func (o *ModuleTagQuery) Profile(typ model.ProfileType, value string) *ModuleTagQuery

func (*ModuleTagQuery) ProfileFromEAT

func (o *ModuleTagQuery) ProfileFromEAT(value ...*eat.Profile) *ModuleTagQuery

func (*ModuleTagQuery) ProfileType

func (o *ModuleTagQuery) ProfileType(value ...model.ProfileType) *ModuleTagQuery

func (*ModuleTagQuery) ProfileValue

func (o *ModuleTagQuery) ProfileValue(value ...string) *ModuleTagQuery

func (*ModuleTagQuery) Run

func (*ModuleTagQuery) UpdateSelectQuery

func (o *ModuleTagQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

func (*ModuleTagQuery) ValidAfter

func (o *ModuleTagQuery) ValidAfter(value time.Time) *ModuleTagQuery

func (*ModuleTagQuery) ValidBefore

func (o *ModuleTagQuery) ValidBefore(value time.Time) *ModuleTagQuery

func (*ModuleTagQuery) ValidBetween

func (o *ModuleTagQuery) ValidBetween(lower, upper time.Time) *ModuleTagQuery

func (*ModuleTagQuery) ValidOn

func (o *ModuleTagQuery) ValidOn(value time.Time) *ModuleTagQuery

type Query

type Query[T model.Model] interface {
	// UpdateSelectQuery updates the bun.SelectQuery using parameters
	// defined by this query object. This only includes the parameters for
	// the database model corresponding to T, and not any sub-queries that
	// might be part of this Query.
	UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)
	// Run this Query against the provided database. If the Query contains
	// sub-queries, those are run first, and their results are used to
	// update the IDs in the main query.
	Run(ctx context.Context, db bun.IDB) ([]T, error)
	// IsEmpty returns true if this Query, and any sub-queries, does not
	// contain any parameters. When an empty query is run, all entries for
	// the model corresponding to T in the store are returned.
	IsEmpty() bool
}

Query is the interface implemented by all objects that can be used to query the contents of the Store.

type QueryGroup

type QueryGroup[M model.Model, Q Query[M]] struct {
	// contains filtered or unexported fields
}

QueryGroup allows multiple queries of the same time to be run together, concatenating their results, effectively constructing a disjunction (OR expression) between individual queries.

func NewQueryGroup

func NewQueryGroup[M model.Model, T Query[M]](sub ...T) *QueryGroup[M, T]

func (*QueryGroup[M, Q]) Add

func (o *QueryGroup[M, Q]) Add(sub ...Q) *QueryGroup[M, Q]

func (*QueryGroup[M, Q]) ForEach

func (o *QueryGroup[M, Q]) ForEach(updater func(v Q))

func (*QueryGroup[M, Q]) IsEmpty

func (o *QueryGroup[M, Q]) IsEmpty() bool

func (*QueryGroup[M, Q]) Length

func (o *QueryGroup[M, Q]) Length() int

func (*QueryGroup[M, Q]) Run

func (o *QueryGroup[M, Q]) Run(ctx context.Context, db bun.IDB) ([]M, error)

func (*QueryGroup[M, Q]) RunGroup

func (o *QueryGroup[M, Q]) RunGroup(ctx context.Context, db bun.IDB) ([][]M, error)

func (*QueryGroup[M, Q]) UpdateSelectQuery

func (o *QueryGroup[M, Q]) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

type Store

type Store struct {
	Ctx context.Context
	DB  bun.IDB
	// contains filtered or unexported fields
}

func Open

func Open(ctx context.Context, cfg *Config) (*Store, error)

Open a Store configured according to provided Config that will use the provided Context for its transactions.

func OpenWithDB

func OpenWithDB(ctx context.Context, db *bun.DB, options ...ConfigOption) (*Store, error)

OpenWithDB opens a store using an existing bun.DB and specified config options.

func (*Store) AddBytes

func (o *Store) AddBytes(buf []byte, label string, activate bool) error

AddBytes adds the CBOR-encoded CoRIM in the provided buffer to the store. Signature validation of signed CoRIMs is not performed (use ValidateAndAddBytes to validate signatures on signed CoRIMs). If insecure transactions are allowed by the Store's configuration, signed CoRIMs will be added without validating their signatures; otherwise, an error will be returned. If activate is true, the contained triples will be activated before they are added.

func (*Store) AddCoRIM

func (o *Store) AddCoRIM(c *corim.UnsignedCorim, digest []byte, label string, activate bool) error

AddCoRIM adds the provided CoRIM to the store. The digest, if not nil, should be the digest of the CBOR token the provided CoRIM was decoded from. If activate is true, the contained triples will be activated before they are added.

func (*Store) AddManifest

func (o *Store) AddManifest(m *model.Manifest) error

AddManifest adds the provided manifest to the store.

func (*Store) AddToken

func (o *Store) AddToken(token *model.Token) error

func (*Store) BeginTx

func (o *Store) BeginTx(opts *sql.TxOptions) (*Store, error)

BeginTx starts an new transaction (bun.Tx) and returns a Store that uses that transaction as its "database". All method invocations on the returned Store will be part of of that transaction. The transaction can be committed or rolled back by accessing it via Tx() method of the returned Store.

func (*Store) Clear

func (o *Store) Clear() error

Clear removes all data from store (effectively truncating the tables containing CoRIM/CoMID data).

func (*Store) Close

func (o *Store) Close() error

Close the Store. If the Store has a database connection (rather than a transaction), the database connection will be closed as well.

func (*Store) ConcatExpr

func (o *Store) ConcatExpr(tokens ...string) string

ConcatExpr returns dialect-specific expression concatenated provided strings.

func (*Store) DeleteManifest

func (o *Store) DeleteManifest(manifestID string, label string) error

DeteleManifest deletes the manifest associated with the specified manifest ID, and all its data, from the store. The ID is the unique ID of the manifest extracted from its token (not the internal database entry ID).

func (*Store) Digest

func (o *Store) Digest(input []byte) []byte

Digest computes the digests of the provided buffer using the store's configured hashing algorithm.

func (*Store) GetActiveKeyTriples

func (o *Store) GetActiveKeyTriples(
	env *comid.Environment,
	label string,
	exact bool,
) ([]*comid.KeyTriple, error)

GetActiveKeyTriples returns a slice of KeyTriple's whose environment matches the one provided. If exact is true, any unset fields in the provided environment must be NULL in the database; otherwise, unset fields will match any value. Only active triples are returned.

func (*Store) GetActiveValueTriples

func (o *Store) GetActiveValueTriples(
	env *comid.Environment,
	label string,
	exact bool,
) ([]*comid.ValueTriple, error)

GetActiveValueTriples returns a slice of ValueTriple's whose environment matches the one provided. If exact is true, any unset fields in the provided environment must be NULL in the database; otherwise, unset fields will match any value. Only active triples are returned.

func (*Store) GetManifest

func (o *Store) GetManifest(manifestID string, label string) (*model.Manifest, error)

GetManifest returns the manifest associated with the specified manifest ID. This is the unique ID of the manifest extracted from its token (not the internal database entry ID).

func (*Store) GetTokenBytes

func (o *Store) GetTokenBytes(manifestID string) ([]byte, error)

GetTokenBytes returns []byte containing the CoRIM token with the specified manifest ID, previously added via AddBytes() or VerifyAndAddBytes(). (note: CoRIMs added via AddCoRIM() AddManifest() do not have token associated with them).

func (*Store) HexExpr

func (o *Store) HexExpr(columnName string) string

HexExpr returns a dialect-specific expression to perform hex encoding on the specified column.

func (*Store) Init

func (o *Store) Init() error

Init inializes a new database with the store's tables

func (*Store) Migrate

func (o *Store) Migrate() error

Migrate upates the tables in the associated database to be compatible with this store. (note: there is no need to run this after invoking Store.Init().)

func (*Store) QueryCoMIDEntities

func (o *Store) QueryCoMIDEntities(query *EntityQuery) ([]*comid.Entity, error)

QueryCoMIDEntities returns comid.Entity's that match the provided query. Note that these are reconstructed from Store content, and are not parsed form the tokens that were originally added to the store.

func (*Store) QueryCoMIDs

func (o *Store) QueryCoMIDs(query Query[*model.ModuleTagEntry]) ([]*comid.Comid, error)

QueryCoMIDs returns comid.Comid's that match the provided query. Note that these are reconstructed from Store content, and are not parsed form the tokens that were originally added to the store.

func (*Store) QueryCoRIMEntities

func (o *Store) QueryCoRIMEntities(query *EntityQuery) ([]*corim.Entity, error)

QueryCoRIMEntities returns corim.Entity's that match the provided query. Note that these are reconstructed from Store content, and are not parsed form the tokens that were originally added to the store.

func (*Store) QueryCoRIMs

func (o *Store) QueryCoRIMs(query Query[*model.ManifestEntry]) ([]*corim.UnsignedCorim, error)

QueryCoRIMs returns corim.UnsignedCorim's that match the provided query. Note that these are reconstructed from Store content, and are not parsed form the tokens that were originally added to the store.

func (*Store) QueryEntityModels

func (o *Store) QueryEntityModels(query Query[*model.Entity]) ([]*model.Entity, error)

QueryEntityModels returns Entity models that match the provided query. If the query is empty or is nil, all Entity's in the Store are returned.

func (*Store) QueryEnvironmentModels

func (o *Store) QueryEnvironmentModels(query Query[*model.Environment]) ([]*model.Environment, error)

QueryEnvironmentModels returns Environment models that match the provided query. If the query is empty or is nil, all Environment's in the Store are returned.

func (*Store) QueryEnvironments

func (o *Store) QueryEnvironments(query Query[*model.Environment]) ([]*comid.Environment, error)

QueryEnvironments returns comid.Environment's that match the provided query. Note that these are reconstructed from Store content, and are not parsed form the tokens that were originally added to the store.

func (*Store) QueryKeyTripleEntries

func (o *Store) QueryKeyTripleEntries(query Query[*model.KeyTripleEntry]) ([]*model.KeyTripleEntry, error)

QueryKeyTripleEntries returns a []*model.KeyTripleEntry with entries matching the provided query. If the query is nil or is empty, all KeyTripleEntry's in the store will be returned.

func (*Store) QueryKeyTripleModels

func (o *Store) QueryKeyTripleModels(query Query[*model.KeyTripleEntry]) ([]*model.KeyTriple, error)

QueryKeyTripleModels returns a []*model.KeyTriple containing triples matching the provided query. If the query is nil or is empty, all KeyTriple's in the store will be returned. Note: this will run additional queries to fully populate matching triples. For queries expecting large results, it is recommended to, where possible, use QueryKeyTripleEntries instead.

func (*Store) QueryKeyTriples

func (o *Store) QueryKeyTriples(query Query[*model.KeyTripleEntry]) ([]*comid.KeyTriple, error)

QueryKeyTriples returns a []*comid.KeyTriples with triples matching provided query.

func (*Store) QueryManifestEntries

func (o *Store) QueryManifestEntries(query Query[*model.ManifestEntry]) ([]*model.ManifestEntry, error)

QueryManifestEntries returns ManifestEntry's that match the provided query. If the query is empty or is nil, all ManifestEntry's in the Store are returned. Unlike Manifest models (see below), ManifestEntry's only contain fields related to the manifest itself and not any of its contents (ModuleTags, DependentRIMs, etc).

func (*Store) QueryManifestModels

func (o *Store) QueryManifestModels(query Query[*model.ManifestEntry]) ([]*model.Manifest, error)

QueryManifestModels returns Manifest models that match the provided query. If the query is empty or is nil, all Manifest's in the Store are returned. The returned Manifest models are fully populated, incuding their contained structures such as ModuleTag's (contrast with QueryManifestEntries above).

func (*Store) QueryModuleTagEntries

func (o *Store) QueryModuleTagEntries(query Query[*model.ModuleTagEntry]) ([]*model.ModuleTagEntry, error)

QueryModuleTagEntries returns ModuleTagEntry's that match the provided query. If the query is empty or is nil, all ModuleTagEntry's in the Store are returned. Unlike ModuleTag models (see below), ModuleTagEntry's only contain fields related to the module tag itself and not any of its contents (triples, linked tags, etc).

func (*Store) QueryModuleTagModels

func (o *Store) QueryModuleTagModels(query Query[*model.ModuleTagEntry]) ([]*model.ModuleTag, error)

QueryModuleTagModels returns ModuleTag models that match the provided query. If the query is empty or is nil, all ModuleTag's in the Store are returned. The returned ModuleTag models are fully populated, incuding their contained structures such as ValueTriple's (contrast with QueryModuleTagEntries above).

func (*Store) QueryTokenModels

func (o *Store) QueryTokenModels(query Query[*model.Token]) ([]*model.Token, error)

QueryTokenModels returns Token's that match the provided query. If the query is empty or is nil, all Token's in the Store are returned.

func (*Store) QueryValueTripleEntries

func (o *Store) QueryValueTripleEntries(query Query[*model.ValueTripleEntry]) ([]*model.ValueTripleEntry, error)

QueryValueTripleEntries returns a []*model.ValueTripleEntry with entries matching the provided query. If the query is nil or is empty, all ValueTripleEntry's in the store will be returned.

func (*Store) QueryValueTripleModels

func (o *Store) QueryValueTripleModels(query Query[*model.ValueTripleEntry]) ([]*model.ValueTriple, error)

QueryValueTripleModels returns a []*model.ValueTriple containing triples matching the provided query. If the query is nil or is empty, all ValueTriple's in the store will be returned. Note: this will run additional queries to fully populate matching triples. For queries expecting large results, it is recommended to, where possible, use QueryValueTripleEntries instead.

func (*Store) QueryValueTriples

func (o *Store) QueryValueTriples(query Query[*model.ValueTripleEntry]) ([]*comid.ValueTriple, error)

QueryValueTriples returns a []*comid.ValueTriples with triples matching provided query.

func (*Store) SetKeyTriplesActive

func (o *Store) SetKeyTriplesActive(
	query Query[*model.KeyTripleEntry],
	value bool,
) ([]*model.KeyTripleEntry, error)

SetKeyTriplesActive sets the active status of key triples matching the specified query to the specified value. On success a slice of entries corresponding to the updated triples is returned. The IsActive field of these entries is set to their old value prior to the update.

func (*Store) SetValueTriplesActive

func (o *Store) SetValueTriplesActive(
	query Query[*model.ValueTripleEntry],
	value bool,
) ([]*model.ValueTripleEntry, error)

SetValueTriplesActive sets the active status of value triples matching the specified query to the specified value. On success a slice of entries corresponding to the updated triples is returned. The IsActive field of these entries is set to their old value prior to the update.

func (*Store) StringAggregatorExpr

func (o *Store) StringAggregatorExpr(columnName string) string

StringAggregatorExpr returns an expression using a dialect-specific function to aggregate the specified column (must be TEXT) into a comma-separated list.

func (*Store) Tx

func (o *Store) Tx() *bun.Tx

Tx return *bun.Tx pointing to the transaction the Store is using as its DB. If Store.DB is not a transaction, nil si returned.

func (*Store) VerifyAndAddBytes

func (o *Store) VerifyAndAddBytes(buf []byte, keys util.KeyStore, label string, activate bool) error

VerifyAndAddBytes verify the signature on the signed CoRIM contained in the buffer using keys in the provided store, and, if successful, add the CoRIM to the store (as with AddBytes).

type TokenQuery

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

func NewTokenQuery

func NewTokenQuery() *TokenQuery

func (*TokenQuery) Authority

func (o *TokenQuery) Authority(updater func(*CryptoKeyQuery)) *TokenQuery

func (*TokenQuery) AuthoritySubquery

func (o *TokenQuery) AuthoritySubquery() *CryptoKeyQuery

func (*TokenQuery) Data

func (o *TokenQuery) Data(value ...[]byte) *TokenQuery

func (*TokenQuery) ID

func (o *TokenQuery) ID(value ...int64) *TokenQuery

func (*TokenQuery) IsEmpty

func (o *TokenQuery) IsEmpty() bool

func (*TokenQuery) IsSigned

func (o *TokenQuery) IsSigned(value ...bool) *TokenQuery

func (*TokenQuery) ManifestID

func (o *TokenQuery) ManifestID(value ...string) *TokenQuery

func (*TokenQuery) Run

func (o *TokenQuery) Run(ctx context.Context, db bun.IDB) ([]*model.Token, error)

func (*TokenQuery) UpdateSelectQuery

func (o *TokenQuery) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

type TripleQuery

type TripleQuery[T model.Model, TT any] struct {
	ManifestCommonQuery
	ModuleTagCommonQuery
	// contains filtered or unexported fields
}

func NewTripleQuery

func NewTripleQuery[T model.Model, TT any]() *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) AddedAfter

func (o *TripleQuery[T, TT]) AddedAfter(value time.Time) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) AddedBefore

func (o *TripleQuery[T, TT]) AddedBefore(value time.Time) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) AddedBetween

func (o *TripleQuery[T, TT]) AddedBetween(lower, upper time.Time) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) AuthorizedBy

func (o *TripleQuery[T, TT]) AuthorizedBy(updater func(e *CryptoKeyQuery)) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) AuthorizedBySubquery

func (o *TripleQuery[T, TT]) AuthorizedBySubquery() *CryptoKeyQuery

func (*TripleQuery[T, TT]) ClassBytes

func (o *TripleQuery[T, TT]) ClassBytes(value ...[]byte) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ClassType

func (o *TripleQuery[T, TT]) ClassType(value string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) CryptoKey

func (o *TripleQuery[T, TT]) CryptoKey(updater func(e *CryptoKeyQuery)) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) CryptoKeysSubquery

func (o *TripleQuery[T, TT]) CryptoKeysSubquery() *CryptoKeyQuery

func (*TripleQuery[T, TT]) Environment

func (o *TripleQuery[T, TT]) Environment(updater func(e *EnvironmentQuery)) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) EnvironmentID

func (o *TripleQuery[T, TT]) EnvironmentID(value ...int64) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) EnvironmentSubquery

func (o *TripleQuery[T, TT]) EnvironmentSubquery() *EnvironmentQuery

func (*TripleQuery[T, TT]) ExactEnvironment

func (o *TripleQuery[T, TT]) ExactEnvironment(value bool) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) GroupBytes

func (o *TripleQuery[T, TT]) GroupBytes(value ...[]byte) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) GroupType

func (o *TripleQuery[T, TT]) GroupType(value string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ID

func (o *TripleQuery[T, TT]) ID(value ...int64) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) Index

func (o *TripleQuery[T, TT]) Index(value ...uint64) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) InstanceBytes

func (o *TripleQuery[T, TT]) InstanceBytes(value ...[]byte) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) InstanceType

func (o *TripleQuery[T, TT]) InstanceType(value string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) IsActive

func (o *TripleQuery[T, TT]) IsActive(value bool) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) IsEmpty

func (o *TripleQuery[T, TT]) IsEmpty() bool

func (*TripleQuery[T, TT]) Label

func (o *TripleQuery[T, TT]) Label(value ...string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) Language

func (o *TripleQuery[T, TT]) Language(value ...string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) Layer

func (o *TripleQuery[T, TT]) Layer(value ...uint64) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ManifestDbID

func (o *TripleQuery[T, TT]) ManifestDbID(value ...int64) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ManifestID

func (o *TripleQuery[T, TT]) ManifestID(typ model.TagIDType, value string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ManifestIDType

func (o *TripleQuery[T, TT]) ManifestIDType(value ...model.TagIDType) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ManifestIDValue

func (o *TripleQuery[T, TT]) ManifestIDValue(value ...string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) Measurement

func (o *TripleQuery[T, TT]) Measurement(updater func(e *MeasurementQuery)) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) MeasurementGroup

func (o *TripleQuery[T, TT]) MeasurementGroup() *MeasurementQueryGroup

func (*TripleQuery[T, TT]) Model

func (o *TripleQuery[T, TT]) Model(value ...string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ModuleTagDbID

func (o *TripleQuery[T, TT]) ModuleTagDbID(value ...int64) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ModuleTagID

func (o *TripleQuery[T, TT]) ModuleTagID(typ model.TagIDType, value string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ModuleTagIDType

func (o *TripleQuery[T, TT]) ModuleTagIDType(value ...model.TagIDType) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ModuleTagIDValue

func (o *TripleQuery[T, TT]) ModuleTagIDValue(value ...string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ModuleTagVersion

func (o *TripleQuery[T, TT]) ModuleTagVersion(value ...uint) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) Profile

func (o *TripleQuery[T, TT]) Profile(typ model.ProfileType, value string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ProfileFromEAT

func (o *TripleQuery[T, TT]) ProfileFromEAT(value ...*eat.Profile) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ProfileType

func (o *TripleQuery[T, TT]) ProfileType(value ...model.ProfileType) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ProfileValue

func (o *TripleQuery[T, TT]) ProfileValue(value ...string) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) Run

func (o *TripleQuery[T, TT]) Run(ctx context.Context, db bun.IDB) ([]T, error)

func (*TripleQuery[T, TT]) TripleDbID

func (o *TripleQuery[T, TT]) TripleDbID(value ...int64) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) TripleType

func (o *TripleQuery[T, TT]) TripleType(value ...TT) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) UpdateSelectQuery

func (o *TripleQuery[T, TT]) UpdateSelectQuery(query *bun.SelectQuery, dialect schema.Dialect)

func (*TripleQuery[T, TT]) ValidAfter

func (o *TripleQuery[T, TT]) ValidAfter(value time.Time) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ValidBefore

func (o *TripleQuery[T, TT]) ValidBefore(value time.Time) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ValidBetween

func (o *TripleQuery[T, TT]) ValidBetween(lower, upper time.Time) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) ValidOn

func (o *TripleQuery[T, TT]) ValidOn(value time.Time) *TripleQuery[T, TT]

func (*TripleQuery[T, TT]) Vendor

func (o *TripleQuery[T, TT]) Vendor(value ...string) *TripleQuery[T, TT]

type ValueTripleQuery

func NewValueTripleQuery

func NewValueTripleQuery() *ValueTripleQuery

func ValueTripleQueryFromStatefulClass

func ValueTripleQueryFromStatefulClass(statefulClass *coserv.StatefulClass) (*ValueTripleQuery, error)

func ValueTripleQueryFromStatefulGroup

func ValueTripleQueryFromStatefulGroup(statefulGroup *coserv.StatefulGroup) (*ValueTripleQuery, error)

func ValueTripleQueryFromStatefulInstance

func ValueTripleQueryFromStatefulInstance(statefulInstance *coserv.StatefulInstance) (*ValueTripleQuery, error)

type ValueTripleQueryGroup

type ValueTripleQueryGroup = QueryGroup[*model.ValueTripleEntry, *ValueTripleQuery]

func NewValueTripleQueryGroup

func NewValueTripleQueryGroup() *ValueTripleQueryGroup

func ValueTripleQueryGroupFromCoSERV

func ValueTripleQueryGroupFromCoSERV(cq *coserv.Query) (*ValueTripleQueryGroup, error)

Jump to

Keyboard shortcuts

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