store

package
v6.2.13 Latest Latest
Warning

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

Go to latest
Published: Sep 22, 2026 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CredentialPropertyRecord

type CredentialPropertyRecord struct {
	// CredentialID refers to the entry record in credential
	CredentialID string `gorm:"primaryKey"`
	// Path is JSON path of the property.
	Path string `gorm:"primaryKey"`
	// Value is the value of the property.
	Value string
}

CredentialPropertyRecord is a property of a Verifiable Credential stored in the SQL database.

func (CredentialPropertyRecord) TableName

func (l CredentialPropertyRecord) TableName() string

TableName returns the table name for this DTO.

type CredentialRecord

type CredentialRecord struct {
	// ID contains the 'id' property of the Verifiable Credential.
	ID string
	// Issuer contains the 'issuer' property of the Verifiable Credential.
	Issuer string
	// SubjectID contains the 'credentialSubject.id' property of the Verifiable Credential.
	SubjectID string
	// Type contains the 'type' property of the Verifiable Credential (not being 'VerifiableCredential').
	Type *string
	// Raw contains the raw JSON of the Verifiable Credential.
	Raw        string
	Properties []CredentialPropertyRecord `gorm:"foreignKey:CredentialID;references:ID"`
}

CredentialRecord is a Verifiable Credential stored in the SQL database.

func (CredentialRecord) TableName

func (p CredentialRecord) TableName() string

TableName returns the table name for this DTO.

type CredentialStore

type CredentialStore struct {
}

CredentialStore stores Verifiable Credentials in a SQL database.

func (CredentialStore) BuildSearchStatement

func (c CredentialStore) BuildSearchStatement(db *gorm.DB, onClauseColumn string, query map[string]string) *gorm.DB

BuildSearchStatement enriches a Gorm query to search for Verifiable Credentials in the SQL database. The db instance must a Gorm query builder which determines the model and subset of credentials to search in using a JOIN or WHERE clause, e.g.: var results []issuedCredential CredentialStore.BuildSearchStatement(

db.Model(&issuedCredential{}).Where("issuer = ?", issuer),
"issued_credential.credential_id",
query,

).Find(&results) In this case, issuedCredential must have a Credential field of type CredentialRecord, which can be mapped by Gorm.

func (CredentialStore) Store

func (c CredentialStore) Store(db *gorm.DB, credential vc.VerifiableCredential) (*CredentialRecord, error)

Store stores a Verifiable Credential in the SQL database.

Jump to

Keyboard shortcuts

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