model

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

Index

Constants

View Source
const (
	IsConfiguredFlag               int64 = 0
	IsSecureFlag                   int64 = 1
	IsRecoveryFlag                 int64 = 2
	IsDebugFlag                    int64 = 3
	IsReplayProtectedFlag          int64 = 4
	IsIntegrityProtectedFlag       int64 = 5
	IsRuntimeMeasuredFlag          int64 = 6
	IsImmutableFlag                int64 = 7
	IsTcbFlag                      int64 = 8
	IsConfidentialityProtectedFlag int64 = 9
)
View Source
const (
	MvalVersion            int64 = 0
	MvalSvn                int64 = 1
	MvalDigests            int64 = 2
	MvalFlags              int64 = 3
	MvalRawValue           int64 = 4
	MvalMACAddr            int64 = 6
	MvalIPAddr             int64 = 7
	MvalSerialNumber       int64 = 8
	MvalUEID               int64 = 9
	MvalUUID               int64 = 10
	MvalName               int64 = 11
	MvalCryptoKeys         int64 = 13
	MvalIntegrityRegisters int64 = 14
	MvalIntRange           int64 = 15
)

Variables

View Source
var SupportedTagIDTypes = []TagIDType{
	StringTagID,
	UUIDTagID,
}

Functions

func CoMIDEntitiesToCoRIM

func CoMIDEntitiesToCoRIM(origin []*Entity) (*comid.Entities, error)

func CoMIDExtensionsToCoRIM

func CoMIDExtensionsToCoRIM(origin []*ExtensionValue) (comid.Extensions, error)

func CoRIMEntitiesToCoRIM

func CoRIMEntitiesToCoRIM(origin []*Entity) (*corim.Entities, error)

func CoRIMExtensionsToCoRIM

func CoRIMExtensionsToCoRIM(origin []*ExtensionValue) (corim.Extensions, error)

func CryptoKeysToCoRIM

func CryptoKeysToCoRIM(origin []*CryptoKey) (*comid.CryptoKeys, error)

func DigestsToCoRIM

func DigestsToCoRIM(origin []*Digest) (*comid.Digests, error)

func FlagsToCoRIM

func FlagsToCoRIM(origin []*Flag) (*comid.FlagsMap, error)

func IntegerityRegistersToCoRIM

func IntegerityRegistersToCoRIM(origin []*IntegrityRegister) (*comid.IntegrityRegisters, error)

func KeyTriplesToCoRIM

func KeyTriplesToCoRIM(origin []*KeyTriple, typ KeyTripleType) (*comid.KeyTriples, error)

func LinkedTagsToCoRIM

func LinkedTagsToCoRIM(origin []*LinkedTag) (*comid.LinkedTags, error)

func LocatorsToCoRIM

func LocatorsToCoRIM(origin []*Locator) (*[]corim.Locator, error)

func MeasurementsToCoRIM

func MeasurementsToCoRIM(origin []*Measurement) (comid.Measurements, error)

func ParseCoMIDRole

func ParseCoMIDRole(text string) (comid.Role, error)

func ParseCoRIMRole

func ParseCoRIMRole(text string) (corim.Role, error)

func RegisterModels

func RegisterModels(db *bun.DB)

func ResetModels

func ResetModels(ctx context.Context, db *bun.DB) error

func UpdateSelectQueryFromEnvironment

func UpdateSelectQueryFromEnvironment(
	query *bun.SelectQuery,
	env *Environment,
	exact bool,
	dialect schema.Dialect,
) *bun.SelectQuery

func ValueTriplesToCoRIM

func ValueTriplesToCoRIM(origin []*ValueTriple, typ ValueTripleType) (*comid.ValueTriples, error)

Types

type CryptoKey

type CryptoKey struct {
	bun.BaseModel `bun:"table:cryptokeys,alias:ck"`

	ID int64 `bun:",pk,autoincrement"`

	KeyType  string
	KeyBytes []byte

	OwnerID   int64  `bun:",nullzero"`
	OwnerType string `bun:",nullzero"`
}

func CryptoKeysFromCoRIM

func CryptoKeysFromCoRIM(origin *comid.CryptoKeys) ([]*CryptoKey, error)

func NewCryptoKeyFromCoRIM

func NewCryptoKeyFromCoRIM(origin *comid.CryptoKey) (*CryptoKey, error)

func SelectCryptoKey

func SelectCryptoKey(ctx context.Context, db bun.IDB, id int64) (*CryptoKey, error)

func (*CryptoKey) DbID

func (o *CryptoKey) DbID() int64

func (*CryptoKey) Delete

func (o *CryptoKey) Delete(ctx context.Context, db bun.IDB) error

func (*CryptoKey) FromCoRIM

func (o *CryptoKey) FromCoRIM(origin *comid.CryptoKey) error

func (*CryptoKey) Insert

func (o *CryptoKey) Insert(ctx context.Context, db bun.IDB) error

func (*CryptoKey) IsTable

func (o *CryptoKey) IsTable() bool

func (*CryptoKey) Select

func (o *CryptoKey) Select(ctx context.Context, db bun.IDB) error

func (*CryptoKey) TableName

func (o *CryptoKey) TableName() string

func (*CryptoKey) ToCoRIM

func (o *CryptoKey) ToCoRIM() (*comid.CryptoKey, error)

type Digest

type Digest struct {
	bun.BaseModel `bun:"table:digests,alias:dgt"`

	ID int64 `bun:",pk,autoincrement"`

	AlgID uint64
	Value []byte

	OwnerID   int64  `bun:",nullzero"`
	OwnerType string `bun:",nullzero"`
}

func DigestsFromCoRIM

func DigestsFromCoRIM(origin *comid.Digests) ([]*Digest, error)

func NewDigest

func NewDigest(alg_id uint64, val []byte) *Digest

func (*Digest) DbID

func (o *Digest) DbID() int64

func (*Digest) Delete

func (o *Digest) Delete(ctx context.Context, db bun.IDB) error

func (*Digest) Insert

func (o *Digest) Insert(ctx context.Context, db bun.IDB) error

func (*Digest) IsTable

func (o *Digest) IsTable() bool

func (*Digest) Select

func (o *Digest) Select(ctx context.Context, db bun.IDB) error

func (*Digest) TableName

func (o *Digest) TableName() string

type Entity

type Entity struct {
	bun.BaseModel `bun:"table:entities,alias:ent"`

	ID int64 `bun:",pk,autoincrement"`

	NameType string
	Name     string
	URI      string `bun:",nullzero"`

	RoleEntries []RoleEntry `bun:"rel:has-many,join:id=entity_id"`

	OwnerID   int64  `bun:",nullzero"`
	OwnerType string `bun:",nullzero"`

	Extensions []*ExtensionValue `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic"`
}

func CoMIDEntitiesFromCoRIM

func CoMIDEntitiesFromCoRIM(origin *comid.Entities) ([]*Entity, error)

func CoRIMEntitiesFromCoRIM

func CoRIMEntitiesFromCoRIM(origin *corim.Entities) ([]*Entity, error)

func NewCoMIDEntityFromCoRIM

func NewCoMIDEntityFromCoRIM(origin *comid.Entity) (*Entity, error)

func NewCoRIMEntityFromCoRIM

func NewCoRIMEntityFromCoRIM(origin *corim.Entity) (*Entity, error)

func (*Entity) DbID

func (o *Entity) DbID() int64

func (*Entity) Delete

func (o *Entity) Delete(ctx context.Context, db bun.IDB) error

func (*Entity) FromCoMIDCoRIM

func (o *Entity) FromCoMIDCoRIM(origin *comid.Entity) error

func (*Entity) FromCoRIMCoRIM

func (o *Entity) FromCoRIMCoRIM(origin *corim.Entity) error

func (*Entity) Insert

func (o *Entity) Insert(ctx context.Context, db bun.IDB) error

func (*Entity) IsTable

func (o *Entity) IsTable() bool

func (*Entity) Roles

func (o *Entity) Roles() []string

func (*Entity) Select

func (o *Entity) Select(ctx context.Context, db bun.IDB) error

func (*Entity) TableName

func (o *Entity) TableName() string

func (*Entity) ToCoMIDCoRIM

func (o *Entity) ToCoMIDCoRIM() (*comid.Entity, error)

func (*Entity) ToCoRIMCoRIM

func (o *Entity) ToCoRIMCoRIM() (*corim.Entity, error)

func (*Entity) Validate

func (o *Entity) Validate() error

type Environment

type Environment struct {
	bun.BaseModel `bun:"table:environments,alias:env"`

	ID int64 `bun:",pk,autoincrement"`

	ClassType  *string
	ClassBytes *[]byte
	Vendor     *string
	Model      *string
	Layer      *uint64
	Index      *uint64

	InstanceType  *string
	InstanceBytes *[]byte

	GroupType  *string
	GroupBytes *[]byte
}

func NewEnvironmentFromCoRIM

func NewEnvironmentFromCoRIM(origin *comid.Environment) (*Environment, error)

func SelectEnvironment

func SelectEnvironment(ctx context.Context, db bun.IDB, id int64) (*Environment, error)

func (*Environment) DbID

func (o *Environment) DbID() int64

func (*Environment) DeleteIfOrphaned

func (o *Environment) DeleteIfOrphaned(ctx context.Context, db bun.IDB) error

func (*Environment) FromCoRIM

func (o *Environment) FromCoRIM(origin *comid.Environment) error

func (*Environment) Insert

func (o *Environment) Insert(ctx context.Context, db bun.IDB) error

func (*Environment) IsEmpty

func (o *Environment) IsEmpty() bool

func (*Environment) IsTable

func (o *Environment) IsTable() bool

func (Environment) RenderParts

func (o Environment) RenderParts() ([][2]string, error)

func (*Environment) Select

func (o *Environment) Select(ctx context.Context, db bun.IDB) error

func (*Environment) TableName

func (o *Environment) TableName() string

func (Environment) ToCoRIM

func (o Environment) ToCoRIM() (*comid.Environment, error)

func (*Environment) Validate

func (o *Environment) Validate() error

type ExtensionValue

type ExtensionValue struct {
	bun.BaseModel `bun:"table:extensions,alias:ext"`

	ID int64 `bun:",pk,autoincrement"`

	FieldKind reflect.Kind
	FieldName string
	JSONTag   string
	CBORTag   string

	ValueBytes []byte
	ValueText  string
	ValueInt   int64
	ValueFloat float64

	OwnerID   int64  `bun:",nullzero"`
	OwnerType string `bun:",nullzero"`
}

func CoMIDExtensionsFromCoRIM

func CoMIDExtensionsFromCoRIM(origin comid.Extensions) ([]*ExtensionValue, error)

func CoRIMExtensionsFromCoRIM

func CoRIMExtensionsFromCoRIM(origin corim.Extensions) ([]*ExtensionValue, error)

func (*ExtensionValue) DbID

func (o *ExtensionValue) DbID() int64

func (*ExtensionValue) Delete

func (o *ExtensionValue) Delete(ctx context.Context, db bun.IDB) error

func (*ExtensionValue) Insert

func (o *ExtensionValue) Insert(ctx context.Context, db bun.IDB) error

func (*ExtensionValue) IsTable

func (o *ExtensionValue) IsTable() bool

func (*ExtensionValue) Select

func (o *ExtensionValue) Select(ctx context.Context, db bun.IDB) error

func (*ExtensionValue) TableName

func (o *ExtensionValue) TableName() string

type Flag

type Flag struct {
	bun.BaseModel `bun:"table:flags,alias:flg"`

	ID int64 `bun:",pk,autoincrement"`

	CodePoint int64
	Value     bool

	MeasurementID int64 `bun:",nullzero"`
}

func FlagsFromCoRIM

func FlagsFromCoRIM(origin *comid.FlagsMap) ([]*Flag, error)

func NewFlag

func NewFlag(cp int64, val bool) *Flag

func (*Flag) DbID

func (o *Flag) DbID() int64

func (*Flag) Delete

func (o *Flag) Delete(ctx context.Context, db bun.IDB) error

func (*Flag) Insert

func (o *Flag) Insert(ctx context.Context, db bun.IDB) error

func (*Flag) IsTable

func (o *Flag) IsTable() bool

func (*Flag) Select

func (o *Flag) Select(ctx context.Context, db bun.IDB) error

func (*Flag) TableName

func (o *Flag) TableName() string

type IntegrityRegister

type IntegrityRegister struct {
	bun.BaseModel `bun:"table:integrity_registers,alias:int"`

	ID int64 `bun:",pk,autoincrement"`

	IndexUint *uint64
	IndexText *string

	Digests []*Digest `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic"`

	MeasurementID int64 `bun:",nullzero"`
}

func IntegerityRegistersFromCoRIM

func IntegerityRegistersFromCoRIM(origin *comid.IntegrityRegisters) ([]*IntegrityRegister, error)

func (*IntegrityRegister) DbID

func (o *IntegrityRegister) DbID() int64

func (*IntegrityRegister) Delete

func (o *IntegrityRegister) Delete(ctx context.Context, db bun.IDB) error

func (*IntegrityRegister) Insert

func (o *IntegrityRegister) Insert(ctx context.Context, db bun.IDB) error

func (*IntegrityRegister) IsTable

func (o *IntegrityRegister) IsTable() bool

func (*IntegrityRegister) Select

func (o *IntegrityRegister) Select(ctx context.Context, db bun.IDB) error

func (*IntegrityRegister) StringIndex

func (o *IntegrityRegister) StringIndex() string

StringIndex return the index of this IntegrityRegister as a string. If IndexText is set, it returns the value it points at, If IndexUint is set, the value it points to formatted as a string is returned. Otherwise, the string "nil" is returned.

func (*IntegrityRegister) TableName

func (o *IntegrityRegister) TableName() string

type KeyTriple

type KeyTriple struct {
	bun.BaseModel `bun:"table:key_triples,alias:kt"`

	ID int64 `bun:",pk,autoincrement"`

	EnvironmentID int64
	Environment   *Environment `bun:"rel:belongs-to,join:environment_id=id"`

	Type    KeyTripleType
	KeyList []*CryptoKey `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:key_triple"`

	AuthorizedBy []*CryptoKey `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:key_triple_auth"`

	IsActive bool

	ModuleID int64 `bun:",nullzero"`
}

func KeyTriplesFromCoRIM

func KeyTriplesFromCoRIM(origin *comid.KeyTriples, typ KeyTripleType) ([]*KeyTriple, error)

func NewKeyTripleFromCoRIM

func NewKeyTripleFromCoRIM(origin *comid.KeyTriple) (*KeyTriple, error)

func SelectKeyTriple

func SelectKeyTriple(ctx context.Context, db bun.IDB, id int64) (*KeyTriple, error)

func (*KeyTriple) DatabaseID

func (o *KeyTriple) DatabaseID() int64

func (*KeyTriple) DbID

func (o *KeyTriple) DbID() int64

func (*KeyTriple) Delete

func (o *KeyTriple) Delete(ctx context.Context, db bun.IDB) error

func (*KeyTriple) FromCoRIM

func (o *KeyTriple) FromCoRIM(origin *comid.KeyTriple) error

func (*KeyTriple) Insert

func (o *KeyTriple) Insert(ctx context.Context, db bun.IDB) error

func (*KeyTriple) IsTable

func (o *KeyTriple) IsTable() bool

func (*KeyTriple) Select

func (o *KeyTriple) Select(ctx context.Context, db bun.IDB) error

func (*KeyTriple) TableName

func (o *KeyTriple) TableName() string

func (*KeyTriple) ToCoRIM

func (o *KeyTriple) ToCoRIM() (*comid.KeyTriple, error)

func (*KeyTriple) TripleType

func (o *KeyTriple) TripleType() string

func (*KeyTriple) Validate

func (o *KeyTriple) Validate() error

type KeyTripleEntry

type KeyTripleEntry struct {
	bun.BaseModel `bun:"table:key_triple_entries,alias:kte"`

	TripleDbID    int64 `bun:"triple_db_id"`
	ManifestDbID  int64 `bun:"manifest_db_id"`
	ModuleTagDbID int64 `bun:"module_tag_db_id"`
	EnvironmentID int64 `bun:"environment_db_id"`

	TripleType KeyTripleType

	IsActive bool

	ManifestIDType TagIDType
	ManifestID     string

	ModuleTagIDType  TagIDType
	ModuleTagID      string
	ModuleTagVersion uint

	Language *string

	Label string `bun:",nullzero"`

	ProfileType ProfileType `bun:",nullzero"`
	Profile     string      `bun:",nullzero"`

	NotBefore *time.Time
	NotAfter  *time.Time
}

func (*KeyTripleEntry) DbID

func (o *KeyTripleEntry) DbID() int64

func (*KeyTripleEntry) IsTable

func (o *KeyTripleEntry) IsTable() bool

func (*KeyTripleEntry) Select

func (o *KeyTripleEntry) Select(ctx context.Context, db bun.IDB) error

func (*KeyTripleEntry) TableName

func (o *KeyTripleEntry) TableName() string

func (*KeyTripleEntry) ToManifest

func (o *KeyTripleEntry) ToManifest(ctx context.Context, db bun.IDB) (*Manifest, error)

func (*KeyTripleEntry) ToModuleTag

func (o *KeyTripleEntry) ToModuleTag(ctx context.Context, db bun.IDB) (*ModuleTag, error)

func (*KeyTripleEntry) ToTriple

func (o *KeyTripleEntry) ToTriple(ctx context.Context, db bun.IDB) (*KeyTriple, error)

type KeyTripleType

type KeyTripleType string
const (
	AttestKeyTriple   KeyTripleType = "attest"
	IdentityKeyTriple KeyTripleType = "identity"
)

type LinkedTag

type LinkedTag struct {
	bun.BaseModel `bun:"table:linked_tags,alias:lnk"`

	ID int64 `bun:",pk,autoincrement"`

	LinkedTagIDType TagIDType
	LinkedTagID     string
	TagRelation     TagRelation

	ModuleID int64 `bun:",nullzero"`
}

func LinkedTagsFromCoRIM

func LinkedTagsFromCoRIM(origin *comid.LinkedTags) ([]*LinkedTag, error)

func NewLinkedTagFromCoRIM

func NewLinkedTagFromCoRIM(origin *comid.LinkedTag) (*LinkedTag, error)

func SelectLinkedTag

func SelectLinkedTag(ctx context.Context, db bun.IDB, id int64) (*LinkedTag, error)

func (*LinkedTag) DbID

func (o *LinkedTag) DbID() int64

func (*LinkedTag) Delete

func (o *LinkedTag) Delete(ctx context.Context, db bun.IDB) error

func (*LinkedTag) FromCoRIM

func (o *LinkedTag) FromCoRIM(origin *comid.LinkedTag) error

func (*LinkedTag) Insert

func (o *LinkedTag) Insert(ctx context.Context, db bun.IDB) error

func (*LinkedTag) IsTable

func (o *LinkedTag) IsTable() bool

func (*LinkedTag) Select

func (o *LinkedTag) Select(ctx context.Context, db bun.IDB) error

func (*LinkedTag) TableName

func (o *LinkedTag) TableName() string

func (*LinkedTag) ToCoRIM

func (o *LinkedTag) ToCoRIM() (*comid.LinkedTag, error)

type Locator

type Locator struct {
	bun.BaseModel `bun:"table:locators,alias:loc"`

	ID int64 `bun:",pk,autoincrement"`

	Href       string
	Thumbprint []*Digest `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:locator"`

	ManifestID int64
}

func LocatorsFromCoRIM

func LocatorsFromCoRIM(origin *[]corim.Locator) ([]*Locator, error)

func NewLocatorFromCoRIM

func NewLocatorFromCoRIM(origin corim.Locator) (*Locator, error)

func (*Locator) DbID

func (o *Locator) DbID() int64

func (*Locator) Delete

func (o *Locator) Delete(ctx context.Context, db bun.IDB) error

func (*Locator) FromCoRIM

func (o *Locator) FromCoRIM(origin corim.Locator) error

func (*Locator) Insert

func (o *Locator) Insert(ctx context.Context, db bun.IDB) error

func (*Locator) IsTable

func (o *Locator) IsTable() bool

func (*Locator) Select

func (o *Locator) Select(ctx context.Context, db bun.IDB) error

func (*Locator) TableName

func (o *Locator) TableName() string

func (*Locator) ToCoRIM

func (o *Locator) ToCoRIM() (corim.Locator, error)

type Manifest

type Manifest struct {
	bun.BaseModel `bun:"table:manifests,alias:man"`

	ID int64 `bun:",pk,autoincrement"`

	ManifestIDType TagIDType
	ManifestID     string

	Digest    []byte
	TimeAdded time.Time
	Label     string `bun:",nullzero"`

	ProfileType ProfileType `bun:",nullzero"`
	Profile     string      `bun:",nullzero"`

	Entities      []*Entity  `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:manifest"`
	DependentRIMs []*Locator `bun:"rel:has-many,join:id=manifest_id"`

	NotBefore *time.Time
	NotAfter  *time.Time

	ModuleTags []*ModuleTag `bun:"rel:has-many,join:id=manifest_id"`

	Extensions []*ExtensionValue `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:module_tag"`
}

func NewManifestFromCoRIM

func NewManifestFromCoRIM(origin *corim.UnsignedCorim) (*Manifest, error)

func SelectManifest

func SelectManifest(ctx context.Context, db bun.IDB, id int64) (*Manifest, error)

func (*Manifest) DbID

func (o *Manifest) DbID() int64

func (*Manifest) Delete

func (o *Manifest) Delete(ctx context.Context, db bun.IDB) error

func (*Manifest) FromCoRIM

func (o *Manifest) FromCoRIM(origin *corim.UnsignedCorim) error

func (*Manifest) Insert

func (o *Manifest) Insert(ctx context.Context, db bun.IDB) error

func (*Manifest) IsTable

func (o *Manifest) IsTable() bool

func (*Manifest) Select

func (o *Manifest) Select(ctx context.Context, db bun.IDB) error

func (*Manifest) SetActive

func (o *Manifest) SetActive(value bool)

func (*Manifest) TableName

func (o *Manifest) TableName() string

func (*Manifest) ToCoRIM

func (o *Manifest) ToCoRIM() (*corim.UnsignedCorim, error)

func (*Manifest) Validate

func (o *Manifest) Validate() error

type ManifestEntry

type ManifestEntry struct {
	bun.BaseModel `bun:"table:manifest_entries,alias:mte"`

	ManifestDbID int64 `bun:"manifest_db_id"`

	ManifestIDType TagIDType
	ManifestID     string

	Label string `bun:",nullzero"`

	ProfileType ProfileType `bun:",nullzero"`
	Profile     string      `bun:",nullzero"`

	NotBefore *time.Time
	NotAfter  *time.Time
}

func (*ManifestEntry) DbID

func (o *ManifestEntry) DbID() int64

func (*ManifestEntry) IsTable

func (o *ManifestEntry) IsTable() bool

func (*ManifestEntry) Select

func (o *ManifestEntry) Select(ctx context.Context, db bun.IDB) error

func (*ManifestEntry) TableName

func (o *ManifestEntry) TableName() string

func (*ManifestEntry) ToManifest

func (o *ManifestEntry) ToManifest(ctx context.Context, db bun.IDB) (*Manifest, error)

type ManifestIDType

type ManifestIDType string

type Measurement

type Measurement struct {
	bun.BaseModel `bun:"table:measurements,alias:mea"`

	ID int64 `bun:",pk,autoincrement"`

	KeyType  *string
	KeyBytes *[]byte

	ValueEntries       []*MeasurementValueEntry `bun:"rel:has-many,join:id=measurement_id"`
	Digests            []*Digest                `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:measurement"`
	Flags              []*Flag                  `bun:"rel:has-many,join:id=measurement_id"`
	IntegrityRegisters []*IntegrityRegister     `bun:"rel:has-many,join:id=measurement_id"`
	Extensions         []*ExtensionValue        `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:measurement"`

	AuthorizedBy []*CryptoKey `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:measurement"`
	OwnerID      int64        `bun:",nullzero"`
	OwnerType    string       `bun:",nullzero"`
}

func MeasurementsFromCoRIM

func MeasurementsFromCoRIM(origin comid.Measurements) ([]*Measurement, error)

func NewMeasurementFromCoRIM

func NewMeasurementFromCoRIM(origin *comid.Measurement) (*Measurement, error)

func SelectMeasurement

func SelectMeasurement(ctx context.Context, db bun.IDB, id int64) (*Measurement, error)

func (*Measurement) DbID

func (o *Measurement) DbID() int64

func (*Measurement) Delete

func (o *Measurement) Delete(ctx context.Context, db bun.IDB) error

func (*Measurement) FromCoRIM

func (o *Measurement) FromCoRIM(origin *comid.Measurement) error

func (*Measurement) Insert

func (o *Measurement) Insert(ctx context.Context, db bun.IDB) error

func (*Measurement) IsTable

func (o *Measurement) IsTable() bool

func (*Measurement) Select

func (o *Measurement) Select(ctx context.Context, db bun.IDB) error

func (*Measurement) TableName

func (o *Measurement) TableName() string

func (*Measurement) ToCoRIM

func (o *Measurement) ToCoRIM() (*comid.Measurement, error)

type MeasurementValueEntry

type MeasurementValueEntry struct {
	bun.BaseModel `bun:"table:measurement_value_entries,alias:mve"`

	ID int64 `bun:",pk,autoincrement"`

	CodePoint  int64
	ValueType  string
	ValueBytes *[]byte
	ValueText  *string
	ValueInt   *int64

	MeasurementID int64
}

func (*MeasurementValueEntry) DbID

func (o *MeasurementValueEntry) DbID() int64

func (*MeasurementValueEntry) Delete

func (o *MeasurementValueEntry) Delete(ctx context.Context, db bun.IDB) error

func (*MeasurementValueEntry) Insert

func (o *MeasurementValueEntry) Insert(ctx context.Context, db bun.IDB) error

func (*MeasurementValueEntry) IsTable

func (o *MeasurementValueEntry) IsTable() bool

func (*MeasurementValueEntry) Select

func (o *MeasurementValueEntry) Select(ctx context.Context, db bun.IDB) error

func (*MeasurementValueEntry) TableName

func (o *MeasurementValueEntry) TableName() string

type Model

type Model interface {
	// DbID is the database ID of this Model; it is guaranteed to be unique
	// among all models of its type. For table models, this correponds to
	// the value of the primary key "id" column of the table; for view
	// models, this corresponds to the "id" column of the primary element
	// comprising the view.
	DbID() int64
	// IsTable returns true if the Model corresponds to a database table;
	// otherwise, the model correponds to a view.
	IsTable() bool
	// TableName is the name of the table/view in the database this Model
	// is populated from.
	TableName() string
	// Select populates the Model from the database, including any nested
	// sub-models. If the field corresponding to the Model's DB ID is not
	// set, an error is returned.
	Select(context.Context, bun.IDB) error
}

Model interface is implemented by all models.

type ModuleTag

type ModuleTag struct {
	bun.BaseModel `bun:"table:module_tags,alias:mt"`

	ID int64 `bun:",pk,autoincrement"`

	TagIDType  TagIDType
	TagID      string
	TagVersion uint

	Language *string

	Entities []*Entity `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:module_tag"`

	ValueTriples []*ValueTriple `bun:"rel:has-many,join:id=module_id"`
	KeyTriples   []*KeyTriple   `bun:"rel:has-many,join:id=module_id"`

	LinkedTags []*LinkedTag `bun:"rel:has-many,join:id=module_id"`

	Extensions        []*ExtensionValue `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:module_tag"`
	TriplesExtensions []*ExtensionValue `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:triples"`

	ManifestID int64
}

func NewModuleTagFromCoRIM

func NewModuleTagFromCoRIM(origin *comid.Comid) (*ModuleTag, error)

func SelectModuleTag

func SelectModuleTag(ctx context.Context, db bun.IDB, id int64) (*ModuleTag, error)

func (*ModuleTag) DbID

func (o *ModuleTag) DbID() int64

func (*ModuleTag) Delete

func (o *ModuleTag) Delete(ctx context.Context, db bun.IDB) error

func (*ModuleTag) FromCoRIM

func (o *ModuleTag) FromCoRIM(origin *comid.Comid) error

func (*ModuleTag) Insert

func (o *ModuleTag) Insert(ctx context.Context, db bun.IDB) error

func (*ModuleTag) IsTable

func (o *ModuleTag) IsTable() bool

func (*ModuleTag) Select

func (o *ModuleTag) Select(ctx context.Context, db bun.IDB) error

func (*ModuleTag) SetActive

func (o *ModuleTag) SetActive(value bool)

func (*ModuleTag) TableName

func (o *ModuleTag) TableName() string

func (*ModuleTag) ToCoRIM

func (o *ModuleTag) ToCoRIM() (*comid.Comid, error)

func (*ModuleTag) Validate

func (o *ModuleTag) Validate() error

type ModuleTagEntry

type ModuleTagEntry struct {
	bun.BaseModel `bun:"table:module_tag_entries,alias:mte"`

	ManifestDbID  int64 `bun:"manifest_db_id"`
	ModuleTagDbID int64 `bun:"module_tag_db_id"`

	ManifestIDType TagIDType
	ManifestID     string

	ModuleTagIDType  TagIDType
	ModuleTagID      string
	ModuleTagVersion uint

	Language *string

	Label string `bun:",nullzero"`

	ProfileType ProfileType `bun:",nullzero"`
	Profile     string      `bun:",nullzero"`

	NotBefore *time.Time
	NotAfter  *time.Time
}

func (*ModuleTagEntry) DbID

func (o *ModuleTagEntry) DbID() int64

func (*ModuleTagEntry) IsTable

func (o *ModuleTagEntry) IsTable() bool

func (*ModuleTagEntry) Select

func (o *ModuleTagEntry) Select(ctx context.Context, db bun.IDB) error

func (*ModuleTagEntry) TableName

func (o *ModuleTagEntry) TableName() string

func (*ModuleTagEntry) ToManifest

func (o *ModuleTagEntry) ToManifest(ctx context.Context, db bun.IDB) (*Manifest, error)

func (*ModuleTagEntry) ToModuleTag

func (o *ModuleTagEntry) ToModuleTag(ctx context.Context, db bun.IDB) (*ModuleTag, error)

type ProfileType

type ProfileType string
const (
	OIDProfile ProfileType = "oid"
	URIProfile ProfileType = "uri"
)

type RoleEntry

type RoleEntry struct {
	bun.BaseModel `bun:"table:roles,alias:rol"`

	ID int64 `bun:",pk,autoincrement"`

	Role string

	EntityID int64
}

func CoMIDRolesFromCoRIM

func CoMIDRolesFromCoRIM(origin comid.Roles) ([]RoleEntry, error)

func CoRIMRolesFromCoRIM

func CoRIMRolesFromCoRIM(origin corim.Roles) ([]RoleEntry, error)

func MustNewCoMIDRoleEntry

func MustNewCoMIDRoleEntry(text string) *RoleEntry

func MustNewCoRIMRoleEntry

func MustNewCoRIMRoleEntry(text string) *RoleEntry

func NewCoMIDRoleEntry

func NewCoMIDRoleEntry(text string) (*RoleEntry, error)

func NewCoRIMRoleEntry

func NewCoRIMRoleEntry(text string) (*RoleEntry, error)

func (*RoleEntry) DbID

func (o *RoleEntry) DbID() int64

func (*RoleEntry) Delete

func (o *RoleEntry) Delete(ctx context.Context, db bun.IDB) error

func (*RoleEntry) Insert

func (o *RoleEntry) Insert(ctx context.Context, db bun.IDB) error

func (*RoleEntry) IsTable

func (o *RoleEntry) IsTable() bool

func (*RoleEntry) Select

func (o *RoleEntry) Select(ctx context.Context, db bun.IDB) error

func (*RoleEntry) TableName

func (o *RoleEntry) TableName() string

type TagIDType

type TagIDType string
const (
	StringTagID TagIDType = "string"
	UUIDTagID   TagIDType = "uuid"
)

type TagRelation

type TagRelation string
const (
	SupplementsRelation TagRelation = "supplements"
	ReplacesRelation    TagRelation = "replaces"
)

type Token

type Token struct {
	bun.BaseModel `bun:"table:tokens,alias:tok"`

	ID int64 `bun:",pk,autoincrement"`

	ManifestID string `bun:",unique"`
	IsSigned   bool
	Data       []byte

	Authority []*CryptoKey `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:token"`
}

func (*Token) DbID

func (o *Token) DbID() int64

func (*Token) Delete

func (o *Token) Delete(ctx context.Context, db bun.IDB) error

func (*Token) Insert

func (o *Token) Insert(ctx context.Context, db bun.IDB) error

func (*Token) IsTable

func (o *Token) IsTable() bool

func (*Token) Select

func (o *Token) Select(ctx context.Context, db bun.IDB) error

func (*Token) TableName

func (o *Token) TableName() string

type ValueTriple

type ValueTriple struct {
	bun.BaseModel `bun:"table:value_triples,alias:vt"`

	ID int64 `bun:",pk,autoincrement"`

	EnvironmentID int64        `bun:",nullzero"`
	Environment   *Environment `bun:"rel:belongs-to,join:environment_id=id"`

	Type         ValueTripleType
	Measurements []*Measurement `bun:"rel:has-many,join:id=owner_id,join:type=owner_type,polymorphic:value_triple"`

	IsActive bool

	ModuleID int64 `bun:",nullzero"`
}

func NewValueTripleFromCoRIM

func NewValueTripleFromCoRIM(origin *comid.ValueTriple) (*ValueTriple, error)

func SelectValueTriple

func SelectValueTriple(ctx context.Context, db bun.IDB, id int64) (*ValueTriple, error)

func ValueTriplesFromCoRIM

func ValueTriplesFromCoRIM(origin *comid.ValueTriples, typ ValueTripleType) ([]*ValueTriple, error)

func (*ValueTriple) DatabaseID

func (o *ValueTriple) DatabaseID() int64

func (*ValueTriple) DbID

func (o *ValueTriple) DbID() int64

func (*ValueTriple) Delete

func (o *ValueTriple) Delete(ctx context.Context, db bun.IDB) error

func (*ValueTriple) FromCoRIM

func (o *ValueTriple) FromCoRIM(origin *comid.ValueTriple) error

func (*ValueTriple) Insert

func (o *ValueTriple) Insert(ctx context.Context, db bun.IDB) error

func (*ValueTriple) IsTable

func (o *ValueTriple) IsTable() bool

func (*ValueTriple) Select

func (o *ValueTriple) Select(ctx context.Context, db bun.IDB) error

func (*ValueTriple) TableName

func (o *ValueTriple) TableName() string

func (*ValueTriple) ToCoRIM

func (o *ValueTriple) ToCoRIM() (*comid.ValueTriple, error)

func (*ValueTriple) TripleType

func (o *ValueTriple) TripleType() string

func (*ValueTriple) Validate

func (o *ValueTriple) Validate() error

type ValueTripleEntry

type ValueTripleEntry struct {
	bun.BaseModel `bun:"table:value_triple_entries,alias:vte"`

	TripleDbID    int64 `bun:"triple_db_id"`
	ManifestDbID  int64 `bun:"manifest_db_id"`
	ModuleTagDbID int64 `bun:"module_tag_db_id"`
	EnvironmentID int64 `bun:"environment_db_id"`

	TripleType ValueTripleType

	IsActive bool

	ManifestIDType TagIDType
	ManifestID     string

	ModuleTagIDType  TagIDType
	ModuleTagID      string
	ModuleTagVersion uint

	Language *string

	Label string `bun:",nullzero"`

	ProfileType ProfileType `bun:",nullzero"`
	Profile     string      `bun:",nullzero"`

	NotBefore *time.Time
	NotAfter  *time.Time
}

func (*ValueTripleEntry) DbID

func (o *ValueTripleEntry) DbID() int64

func (*ValueTripleEntry) IsTable

func (o *ValueTripleEntry) IsTable() bool

func (*ValueTripleEntry) Select

func (o *ValueTripleEntry) Select(ctx context.Context, db bun.IDB) error

func (*ValueTripleEntry) TableName

func (o *ValueTripleEntry) TableName() string

func (*ValueTripleEntry) ToManifest

func (o *ValueTripleEntry) ToManifest(ctx context.Context, db bun.IDB) (*Manifest, error)

func (*ValueTripleEntry) ToModuleTag

func (o *ValueTripleEntry) ToModuleTag(ctx context.Context, db bun.IDB) (*ModuleTag, error)

func (*ValueTripleEntry) ToTriple

func (o *ValueTripleEntry) ToTriple(ctx context.Context, db bun.IDB) (*ValueTriple, error)

type ValueTripleType

type ValueTripleType string
const (
	ReferenceValueTriple ValueTripleType = "reference"
	EndorsedValueTriple  ValueTripleType = "endorsement"
)

Jump to

Keyboard shortcuts

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