Files
sonr/api/did/v1/state.cosmos_orm.go
T
Prad NukalaandGitHub 8010e6b069 Feature/update dockerfile (#6)
* chore: remove unused new.Dockerfile

* feat: add DID model definitions

* fix: Fix EncodePublicKey method in KeyInfo struct

* feat: Update `EncodePublicKey` to be the inverse of `DecodePublicKey`

* refactor: update AssetInfo protobuf definition

* fix: update default assets with correct asset types

* fix: Initialize IPFS client and check for mounted directories

* feat: Improve IPFS client initialization and mount checking

* feat: Add local filesystem check for IPFS and IPNS

* fix: Use Unixfs().Get() instead of Cat() for IPFS and IPNS content retrieval

* feat: Update GetCID and GetIPNS functions to read data from IPFS node

* fix: Ensure IPFS client is initialized before pinning CID

* feat: Add AddFile and AddFolder methods

* feat: add IPFS file system abstraction

* feat: Implement IPFS file, location, and filesystem abstractions

* refactor: remove unused functions and types

* refactor: remove unused FileSystem interface

* feat: add initial wasm entrypoint

* feat: add basic vault command operations

* docs: add vault module features

* test: remove test for MsgUpdateParams

* refactor: Replace PrimaryKey with Property struct in zkprop.go

* feat: Update the `CreateWitness` and `CreateAccumulator` and `VerifyWitness` and `UpdateAccumulator` to Use the new `Accumulator` and `Witness` types. Then Clean up the code in the file and refactor the marshalling methods

* <no value>

* feat: add KeyCurve and KeyType to KeyInfo in genesis

* feat: add WASM build step to devbox.json

* feat: Add zkgate.go file

* feat: Uncomment and modify zkgate code to work with Property struct

* feat: Merge zkgate.go and zkprop.go logic

* feat: implement API endpoints for profile management

* refactor: remove unused template file

* feat(orm): remove unused ORM models

* feat: add persistent SQLite database support in WASM

* fix: Update module names in protobuf files

* feat: Add method to initialize SQLite database

* fix: update go-sqlite3 dependency to version 1.14.23

* feat: introduce database layer

* feat: Implement database layer for Vault node

* feature/update-dockerfile

* feat: Add keyshares table

* fix: Reorder the SQL statements in the tables.go file

* feat: Update the `createCredentialsTable` method to match the proper Credential struct

* feat: Update createProfilesTable and add createPropertiesTable

* feat: Add constant SQL queries to queries.go and use prepared statements in db.go

* feat: Add createKeysharesTable to internal/db/db.go

* feat: Update `createPermissionsTable` to match Permissions struct

* feat: Add database enum types

* feat: Add DIDNamespace and PermissionScope enums

* feat: Add DBConfig and DBOption types

* feat: Update the db implementation to use the provided go library

* fix: update db implementation to use go-sqlite3 v0.18.2

* fix: Refactor database connection and statement handling

* feat: Simplify db.go implementation

* feat: Convert constant SQL queries to functions in queries.go and update db.go to use prepared statements

* feat: Add models.go file with database table structs

* fix: Remove unused statement map and prepare statements

diff --git a/internal/db/db.go b/internal/db/db.go
index 201d09b..d4d4d4e 100644
--- a/internal/db/db.go
+++ b/internal/db/db.go
@@ -32,11 +32,6 @@ func Open(config *DBConfig) (*DB, error) {
 		Conn: conn,
 	}

-	if err := createTables(db); err != nil {
-		conn.Close()
-		return nil, fmt.Errorf("failed to create tables: %w", err)
-	}
-
 	return db, nil
 }

@@ -61,114 +56,3 @@ func createTables(db *DB) error {
 	return nil
 }

-// AddAccount adds a new account to the database
-func (db *DB) AddAccount(name, address string) error {
-	return db.Exec(insertAccountQuery(name, address))
-}
-
-// AddAsset adds a new asset to the database
-func (db *DB) AddAsset(name, symbol string, decimals int, chainID int64) error {
-	return db.Exec(insertAssetQuery(name, symbol, decimals, chainID))
-}
-
-// AddChain adds a new chain to the database
-func (db *DB) AddChain(name, networkID string) error {
-	return db.Exec(insertChainQuery(name, networkID))
-}
-
-// AddCredential adds a new credential to the database
-func (db *DB) AddCredential(
-	handle, controller, attestationType, origin string,
-	credentialID, publicKey []byte,
-	transport string,
-	signCount uint32,
-	userPresent, userVerified, backupEligible, backupState, cloneWarning bool,
-) error {
-	return db.Exec(insertCredentialQuery(
-		handle,
-		controller,
-		attestationType,
-		origin,
-		credentialID,
-		publicKey,
-		transport,
-		signCount,
-		userPresent,
-		userVerified,
-		backupEligible,
-		backupState,
-		cloneWarning,
-	))
-}
-
-// AddProfile adds a new profile to the database
-func (db *DB) AddProfile(
-	id, subject, controller, originURI, publicMetadata, privateMetadata string,
-) error {
-	return db.statements["insertProfile"].Exec(
-		id, subject, controller, originURI, publicMetadata, privateMetadata,
-	)
-}
-
-// AddProperty adds a new property to the database
-func (db *DB) AddProperty(
-	profileID, key, accumulator, propertyKey string,
-) error {
-	return db.statements["insertProperty"].Exec(
-		profileID, key, accumulator, propertyKey,
-	)
-}
-
-// AddPermission adds a new permission to the database
-func (db *DB) AddPermission(
-	serviceID string,
-	grants []DIDNamespace,
-	scopes []PermissionScope,
-) error {
-	grantsJSON, err := json.Marshal(grants)
-	if err != nil {
-		return fmt.Errorf("failed to marshal grants: %w", err)
-	}
-
-	scopesJSON, err := json.Marshal(scopes)
-	if err != nil {
-		return fmt.Errorf("failed to marshal scopes: %w", err)
-	}
-
-	return db.statements["insertPermission"].Exec(
-		serviceID, string(grantsJSON), string(scopesJSON),
-	)
-}
-
-// GetPermission retrieves the permission for the given service ID
-func (db *DB) GetPermission(serviceID string) ([]DIDNamespace, []PermissionScope, error) {
-	row := db.statements["getPermission"].QueryRow(serviceID)
-
-	var grantsJSON, scopesJSON string
-	if err := row.Scan(&grantsJSON, &scopesJSON); err != nil {
-		return nil, nil, fmt.Errorf("failed to get permission: %w", err)
-	}
-
-	var grants []DIDNamespace
-	if err := json.Unmarshal([]byte(grantsJSON), &grants); err != nil {
-		return nil, nil, fmt.Errorf("failed to unmarshal grants: %w", err)
-	}
-
-	var scopes []PermissionScope
-	if err := json.Unmarshal([]byte(scopesJSON), &scopes); err != nil {
-		return nil, nil, fmt.Errorf("failed to unmarshal scopes: %w", err)
-	}
-
-	return grants, scopes, nil
-}
-
-// Close closes the database connection and finalizes all prepared statements
-func (db *DB) Close() error {
-	for _, stmt := range db.statements {
-		stmt.Finalize()
-	}
-	return db.Conn.Close()
-}
diff --git a/internal/db/queries.go b/internal/db/queries.go
index 807d701..e69de29 100644
--- a/internal/db/queries.go
+++ b/internal/db/queries.go
@@ -1,79 +0,0 @@
-package db
-
-import "fmt"
-
-// Account queries
-func insertAccountQuery(name, address string) string {
-	return fmt.Sprintf(`INSERT INTO accounts (name, address) VALUES (%s, %s)`, name, address)
-}
-
-// Asset queries
-func insertAssetQuery(name, symbol string, decimals int, chainID int64) string {
-	return fmt.Sprintf(
-		`INSERT INTO assets (name, symbol, decimals, chain_id) VALUES (%s, %s, %d, %d)`,
-		name,
-		symbol,
-		decimals,
-		chainID,
-	)
-}
-
-// Chain queries
-func insertChainQuery(name string, networkID string) string {
-	return fmt.Sprintf(`INSERT INTO chains (name, network_id) VALUES (%s, %d)`, name, networkID)
-}
-
-// Credential queries
-func insertCredentialQuery(
-	handle, controller, attestationType, origin string,
-	credentialID, publicKey []byte,
-	transport string,
-	signCount uint32,
-	userPresent, userVerified, backupEligible, backupState, cloneWarning bool,
-) string {
-	return fmt.Sprintf(`INSERT INTO credentials (
-		handle, controller, attestation_type, origin,
-		credential_id, public_key, transport, sign_count,
-		user_present, user_verified, backup_eligible,
-		backup_state, clone_warning
-	) VALUES (%s, %s, %s, %s, %s, %s, %s, %d, %t, %t, %t, %t, %t)`,
-		handle, controller, attestationType, origin,
-		credentialID, publicKey, transport, signCount,
-		userPresent, userVerified, backupEligible,
-		backupState, cloneWarning)
-}
-
-// Profile queries
-func insertProfileQuery(
-	id, subject, controller, originURI, publicMetadata, privateMetadata string,
-) string {
-	return fmt.Sprintf(`INSERT INTO profiles (
-		id, subject, controller, origin_uri,
-		public_metadata, private_metadata
-	) VALUES (%s, %s, %s, %s, %s, %s)`,
-		id, subject, controller, originURI,
-		publicMetadata, privateMetadata)
-}
-
-// Property queries
-func insertPropertyQuery(profileID, key, accumulator, propertyKey string) string {
-	return fmt.Sprintf(`INSERT INTO properties (
-		profile_id, key, accumulator, property_key
-	) VALUES (%s, %s, %s, %s)`,
-		profileID, key, accumulator, propertyKey)
-}
-
-// Permission queries
-func insertPermissionQuery(serviceID, grants, scopes string) string {
-	return fmt.Sprintf(
-		`INSERT INTO permissions (service_id, grants, scopes) VALUES (%s, %s, %s)`,
-		serviceID,
-		grants,
-		scopes,
-	)
-}
-
-// GetPermission query
-func getPermissionQuery(serviceID string) string {
-	return fmt.Sprintf(`SELECT grants, scopes FROM permissions WHERE service_id = %s`, serviceID)
-}

* fix: update Makefile to use sonrd instead of wasmd

* feat: Add targets for templ and vault in Makefile and use only make in devbox.json

* feat: add SQLite database support

* bump: version 0.6.0 → 0.7.0

* refactor: upgrade actions to latest versions
2024-09-05 01:24:57 -04:00

1128 lines
39 KiB
Go

// Code generated by protoc-gen-go-cosmos-orm. DO NOT EDIT.
package didv1
import (
context "context"
ormlist "cosmossdk.io/orm/model/ormlist"
ormtable "cosmossdk.io/orm/model/ormtable"
ormerrors "cosmossdk.io/orm/types/ormerrors"
)
type AssertionTable interface {
Insert(ctx context.Context, assertion *Assertion) error
Update(ctx context.Context, assertion *Assertion) error
Save(ctx context.Context, assertion *Assertion) error
Delete(ctx context.Context, assertion *Assertion) error
Has(ctx context.Context, id string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Assertion, error)
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Assertion, error)
HasByControllerOrigin(ctx context.Context, controller string, origin string) (found bool, err error)
// GetByControllerOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerOrigin(ctx context.Context, controller string, origin string) (*Assertion, error)
HasByControllerCredentialLabel(ctx context.Context, controller string, credential_label string) (found bool, err error)
// GetByControllerCredentialLabel returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerCredentialLabel(ctx context.Context, controller string, credential_label string) (*Assertion, error)
List(ctx context.Context, prefixKey AssertionIndexKey, opts ...ormlist.Option) (AssertionIterator, error)
ListRange(ctx context.Context, from, to AssertionIndexKey, opts ...ormlist.Option) (AssertionIterator, error)
DeleteBy(ctx context.Context, prefixKey AssertionIndexKey) error
DeleteRange(ctx context.Context, from, to AssertionIndexKey) error
doNotImplement()
}
type AssertionIterator struct {
ormtable.Iterator
}
func (i AssertionIterator) Value() (*Assertion, error) {
var assertion Assertion
err := i.UnmarshalMessage(&assertion)
return &assertion, err
}
type AssertionIndexKey interface {
id() uint32
values() []interface{}
assertionIndexKey()
}
// primary key starting index..
type AssertionPrimaryKey = AssertionIdIndexKey
type AssertionIdIndexKey struct {
vs []interface{}
}
func (x AssertionIdIndexKey) id() uint32 { return 0 }
func (x AssertionIdIndexKey) values() []interface{} { return x.vs }
func (x AssertionIdIndexKey) assertionIndexKey() {}
func (this AssertionIdIndexKey) WithId(id string) AssertionIdIndexKey {
this.vs = []interface{}{id}
return this
}
type AssertionSubjectOriginIndexKey struct {
vs []interface{}
}
func (x AssertionSubjectOriginIndexKey) id() uint32 { return 1 }
func (x AssertionSubjectOriginIndexKey) values() []interface{} { return x.vs }
func (x AssertionSubjectOriginIndexKey) assertionIndexKey() {}
func (this AssertionSubjectOriginIndexKey) WithSubject(subject string) AssertionSubjectOriginIndexKey {
this.vs = []interface{}{subject}
return this
}
func (this AssertionSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) AssertionSubjectOriginIndexKey {
this.vs = []interface{}{subject, origin}
return this
}
type AssertionControllerOriginIndexKey struct {
vs []interface{}
}
func (x AssertionControllerOriginIndexKey) id() uint32 { return 2 }
func (x AssertionControllerOriginIndexKey) values() []interface{} { return x.vs }
func (x AssertionControllerOriginIndexKey) assertionIndexKey() {}
func (this AssertionControllerOriginIndexKey) WithController(controller string) AssertionControllerOriginIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this AssertionControllerOriginIndexKey) WithControllerOrigin(controller string, origin string) AssertionControllerOriginIndexKey {
this.vs = []interface{}{controller, origin}
return this
}
type AssertionControllerCredentialLabelIndexKey struct {
vs []interface{}
}
func (x AssertionControllerCredentialLabelIndexKey) id() uint32 { return 3 }
func (x AssertionControllerCredentialLabelIndexKey) values() []interface{} { return x.vs }
func (x AssertionControllerCredentialLabelIndexKey) assertionIndexKey() {}
func (this AssertionControllerCredentialLabelIndexKey) WithController(controller string) AssertionControllerCredentialLabelIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this AssertionControllerCredentialLabelIndexKey) WithControllerCredentialLabel(controller string, credential_label string) AssertionControllerCredentialLabelIndexKey {
this.vs = []interface{}{controller, credential_label}
return this
}
type assertionTable struct {
table ormtable.Table
}
func (this assertionTable) Insert(ctx context.Context, assertion *Assertion) error {
return this.table.Insert(ctx, assertion)
}
func (this assertionTable) Update(ctx context.Context, assertion *Assertion) error {
return this.table.Update(ctx, assertion)
}
func (this assertionTable) Save(ctx context.Context, assertion *Assertion) error {
return this.table.Save(ctx, assertion)
}
func (this assertionTable) Delete(ctx context.Context, assertion *Assertion) error {
return this.table.Delete(ctx, assertion)
}
func (this assertionTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this assertionTable) Get(ctx context.Context, id string) (*Assertion, error) {
var assertion Assertion
found, err := this.table.PrimaryKey().Get(ctx, &assertion, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &assertion, nil
}
func (this assertionTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
subject,
origin,
)
}
func (this assertionTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Assertion, error) {
var assertion Assertion
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &assertion,
subject,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &assertion, nil
}
func (this assertionTable) HasByControllerOrigin(ctx context.Context, controller string, origin string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
controller,
origin,
)
}
func (this assertionTable) GetByControllerOrigin(ctx context.Context, controller string, origin string) (*Assertion, error) {
var assertion Assertion
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &assertion,
controller,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &assertion, nil
}
func (this assertionTable) HasByControllerCredentialLabel(ctx context.Context, controller string, credential_label string) (found bool, err error) {
return this.table.GetIndexByID(3).(ormtable.UniqueIndex).Has(ctx,
controller,
credential_label,
)
}
func (this assertionTable) GetByControllerCredentialLabel(ctx context.Context, controller string, credential_label string) (*Assertion, error) {
var assertion Assertion
found, err := this.table.GetIndexByID(3).(ormtable.UniqueIndex).Get(ctx, &assertion,
controller,
credential_label,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &assertion, nil
}
func (this assertionTable) List(ctx context.Context, prefixKey AssertionIndexKey, opts ...ormlist.Option) (AssertionIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return AssertionIterator{it}, err
}
func (this assertionTable) ListRange(ctx context.Context, from, to AssertionIndexKey, opts ...ormlist.Option) (AssertionIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return AssertionIterator{it}, err
}
func (this assertionTable) DeleteBy(ctx context.Context, prefixKey AssertionIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this assertionTable) DeleteRange(ctx context.Context, from, to AssertionIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this assertionTable) doNotImplement() {}
var _ AssertionTable = assertionTable{}
func NewAssertionTable(db ormtable.Schema) (AssertionTable, error) {
table := db.GetTable(&Assertion{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Assertion{}).ProtoReflect().Descriptor().FullName()))
}
return assertionTable{table}, nil
}
type AttestationTable interface {
Insert(ctx context.Context, attestation *Attestation) error
Update(ctx context.Context, attestation *Attestation) error
Save(ctx context.Context, attestation *Attestation) error
Delete(ctx context.Context, attestation *Attestation) error
Has(ctx context.Context, id string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Attestation, error)
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Attestation, error)
HasByControllerOrigin(ctx context.Context, controller string, origin string) (found bool, err error)
// GetByControllerOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerOrigin(ctx context.Context, controller string, origin string) (*Attestation, error)
List(ctx context.Context, prefixKey AttestationIndexKey, opts ...ormlist.Option) (AttestationIterator, error)
ListRange(ctx context.Context, from, to AttestationIndexKey, opts ...ormlist.Option) (AttestationIterator, error)
DeleteBy(ctx context.Context, prefixKey AttestationIndexKey) error
DeleteRange(ctx context.Context, from, to AttestationIndexKey) error
doNotImplement()
}
type AttestationIterator struct {
ormtable.Iterator
}
func (i AttestationIterator) Value() (*Attestation, error) {
var attestation Attestation
err := i.UnmarshalMessage(&attestation)
return &attestation, err
}
type AttestationIndexKey interface {
id() uint32
values() []interface{}
attestationIndexKey()
}
// primary key starting index..
type AttestationPrimaryKey = AttestationIdIndexKey
type AttestationIdIndexKey struct {
vs []interface{}
}
func (x AttestationIdIndexKey) id() uint32 { return 0 }
func (x AttestationIdIndexKey) values() []interface{} { return x.vs }
func (x AttestationIdIndexKey) attestationIndexKey() {}
func (this AttestationIdIndexKey) WithId(id string) AttestationIdIndexKey {
this.vs = []interface{}{id}
return this
}
type AttestationSubjectOriginIndexKey struct {
vs []interface{}
}
func (x AttestationSubjectOriginIndexKey) id() uint32 { return 1 }
func (x AttestationSubjectOriginIndexKey) values() []interface{} { return x.vs }
func (x AttestationSubjectOriginIndexKey) attestationIndexKey() {}
func (this AttestationSubjectOriginIndexKey) WithSubject(subject string) AttestationSubjectOriginIndexKey {
this.vs = []interface{}{subject}
return this
}
func (this AttestationSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) AttestationSubjectOriginIndexKey {
this.vs = []interface{}{subject, origin}
return this
}
type AttestationControllerOriginIndexKey struct {
vs []interface{}
}
func (x AttestationControllerOriginIndexKey) id() uint32 { return 2 }
func (x AttestationControllerOriginIndexKey) values() []interface{} { return x.vs }
func (x AttestationControllerOriginIndexKey) attestationIndexKey() {}
func (this AttestationControllerOriginIndexKey) WithController(controller string) AttestationControllerOriginIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this AttestationControllerOriginIndexKey) WithControllerOrigin(controller string, origin string) AttestationControllerOriginIndexKey {
this.vs = []interface{}{controller, origin}
return this
}
type attestationTable struct {
table ormtable.Table
}
func (this attestationTable) Insert(ctx context.Context, attestation *Attestation) error {
return this.table.Insert(ctx, attestation)
}
func (this attestationTable) Update(ctx context.Context, attestation *Attestation) error {
return this.table.Update(ctx, attestation)
}
func (this attestationTable) Save(ctx context.Context, attestation *Attestation) error {
return this.table.Save(ctx, attestation)
}
func (this attestationTable) Delete(ctx context.Context, attestation *Attestation) error {
return this.table.Delete(ctx, attestation)
}
func (this attestationTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this attestationTable) Get(ctx context.Context, id string) (*Attestation, error) {
var attestation Attestation
found, err := this.table.PrimaryKey().Get(ctx, &attestation, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &attestation, nil
}
func (this attestationTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
subject,
origin,
)
}
func (this attestationTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Attestation, error) {
var attestation Attestation
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &attestation,
subject,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &attestation, nil
}
func (this attestationTable) HasByControllerOrigin(ctx context.Context, controller string, origin string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
controller,
origin,
)
}
func (this attestationTable) GetByControllerOrigin(ctx context.Context, controller string, origin string) (*Attestation, error) {
var attestation Attestation
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &attestation,
controller,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &attestation, nil
}
func (this attestationTable) List(ctx context.Context, prefixKey AttestationIndexKey, opts ...ormlist.Option) (AttestationIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return AttestationIterator{it}, err
}
func (this attestationTable) ListRange(ctx context.Context, from, to AttestationIndexKey, opts ...ormlist.Option) (AttestationIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return AttestationIterator{it}, err
}
func (this attestationTable) DeleteBy(ctx context.Context, prefixKey AttestationIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this attestationTable) DeleteRange(ctx context.Context, from, to AttestationIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this attestationTable) doNotImplement() {}
var _ AttestationTable = attestationTable{}
func NewAttestationTable(db ormtable.Schema) (AttestationTable, error) {
table := db.GetTable(&Attestation{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Attestation{}).ProtoReflect().Descriptor().FullName()))
}
return attestationTable{table}, nil
}
type ControllerTable interface {
Insert(ctx context.Context, controller *Controller) error
Update(ctx context.Context, controller *Controller) error
Save(ctx context.Context, controller *Controller) error
Delete(ctx context.Context, controller *Controller) error
Has(ctx context.Context, id string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Controller, error)
HasByAddress(ctx context.Context, address string) (found bool, err error)
// GetByAddress returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByAddress(ctx context.Context, address string) (*Controller, error)
HasByVaultCid(ctx context.Context, vault_cid string) (found bool, err error)
// GetByVaultCid returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByVaultCid(ctx context.Context, vault_cid string) (*Controller, error)
List(ctx context.Context, prefixKey ControllerIndexKey, opts ...ormlist.Option) (ControllerIterator, error)
ListRange(ctx context.Context, from, to ControllerIndexKey, opts ...ormlist.Option) (ControllerIterator, error)
DeleteBy(ctx context.Context, prefixKey ControllerIndexKey) error
DeleteRange(ctx context.Context, from, to ControllerIndexKey) error
doNotImplement()
}
type ControllerIterator struct {
ormtable.Iterator
}
func (i ControllerIterator) Value() (*Controller, error) {
var controller Controller
err := i.UnmarshalMessage(&controller)
return &controller, err
}
type ControllerIndexKey interface {
id() uint32
values() []interface{}
controllerIndexKey()
}
// primary key starting index..
type ControllerPrimaryKey = ControllerIdIndexKey
type ControllerIdIndexKey struct {
vs []interface{}
}
func (x ControllerIdIndexKey) id() uint32 { return 0 }
func (x ControllerIdIndexKey) values() []interface{} { return x.vs }
func (x ControllerIdIndexKey) controllerIndexKey() {}
func (this ControllerIdIndexKey) WithId(id string) ControllerIdIndexKey {
this.vs = []interface{}{id}
return this
}
type ControllerAddressIndexKey struct {
vs []interface{}
}
func (x ControllerAddressIndexKey) id() uint32 { return 1 }
func (x ControllerAddressIndexKey) values() []interface{} { return x.vs }
func (x ControllerAddressIndexKey) controllerIndexKey() {}
func (this ControllerAddressIndexKey) WithAddress(address string) ControllerAddressIndexKey {
this.vs = []interface{}{address}
return this
}
type ControllerVaultCidIndexKey struct {
vs []interface{}
}
func (x ControllerVaultCidIndexKey) id() uint32 { return 2 }
func (x ControllerVaultCidIndexKey) values() []interface{} { return x.vs }
func (x ControllerVaultCidIndexKey) controllerIndexKey() {}
func (this ControllerVaultCidIndexKey) WithVaultCid(vault_cid string) ControllerVaultCidIndexKey {
this.vs = []interface{}{vault_cid}
return this
}
type controllerTable struct {
table ormtable.Table
}
func (this controllerTable) Insert(ctx context.Context, controller *Controller) error {
return this.table.Insert(ctx, controller)
}
func (this controllerTable) Update(ctx context.Context, controller *Controller) error {
return this.table.Update(ctx, controller)
}
func (this controllerTable) Save(ctx context.Context, controller *Controller) error {
return this.table.Save(ctx, controller)
}
func (this controllerTable) Delete(ctx context.Context, controller *Controller) error {
return this.table.Delete(ctx, controller)
}
func (this controllerTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this controllerTable) Get(ctx context.Context, id string) (*Controller, error) {
var controller Controller
found, err := this.table.PrimaryKey().Get(ctx, &controller, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &controller, nil
}
func (this controllerTable) HasByAddress(ctx context.Context, address string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
address,
)
}
func (this controllerTable) GetByAddress(ctx context.Context, address string) (*Controller, error) {
var controller Controller
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &controller,
address,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &controller, nil
}
func (this controllerTable) HasByVaultCid(ctx context.Context, vault_cid string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
vault_cid,
)
}
func (this controllerTable) GetByVaultCid(ctx context.Context, vault_cid string) (*Controller, error) {
var controller Controller
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &controller,
vault_cid,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &controller, nil
}
func (this controllerTable) List(ctx context.Context, prefixKey ControllerIndexKey, opts ...ormlist.Option) (ControllerIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ControllerIterator{it}, err
}
func (this controllerTable) ListRange(ctx context.Context, from, to ControllerIndexKey, opts ...ormlist.Option) (ControllerIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ControllerIterator{it}, err
}
func (this controllerTable) DeleteBy(ctx context.Context, prefixKey ControllerIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this controllerTable) DeleteRange(ctx context.Context, from, to ControllerIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this controllerTable) doNotImplement() {}
var _ ControllerTable = controllerTable{}
func NewControllerTable(db ormtable.Schema) (ControllerTable, error) {
table := db.GetTable(&Controller{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Controller{}).ProtoReflect().Descriptor().FullName()))
}
return controllerTable{table}, nil
}
type DelegationTable interface {
Insert(ctx context.Context, delegation *Delegation) error
Update(ctx context.Context, delegation *Delegation) error
Save(ctx context.Context, delegation *Delegation) error
Delete(ctx context.Context, delegation *Delegation) error
Has(ctx context.Context, id string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Delegation, error)
HasByAccountAddressChainId(ctx context.Context, account_address string, chain_id string) (found bool, err error)
// GetByAccountAddressChainId returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByAccountAddressChainId(ctx context.Context, account_address string, chain_id string) (*Delegation, error)
HasByControllerAccountLabel(ctx context.Context, controller string, account_label string) (found bool, err error)
// GetByControllerAccountLabel returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerAccountLabel(ctx context.Context, controller string, account_label string) (*Delegation, error)
List(ctx context.Context, prefixKey DelegationIndexKey, opts ...ormlist.Option) (DelegationIterator, error)
ListRange(ctx context.Context, from, to DelegationIndexKey, opts ...ormlist.Option) (DelegationIterator, error)
DeleteBy(ctx context.Context, prefixKey DelegationIndexKey) error
DeleteRange(ctx context.Context, from, to DelegationIndexKey) error
doNotImplement()
}
type DelegationIterator struct {
ormtable.Iterator
}
func (i DelegationIterator) Value() (*Delegation, error) {
var delegation Delegation
err := i.UnmarshalMessage(&delegation)
return &delegation, err
}
type DelegationIndexKey interface {
id() uint32
values() []interface{}
delegationIndexKey()
}
// primary key starting index..
type DelegationPrimaryKey = DelegationIdIndexKey
type DelegationIdIndexKey struct {
vs []interface{}
}
func (x DelegationIdIndexKey) id() uint32 { return 0 }
func (x DelegationIdIndexKey) values() []interface{} { return x.vs }
func (x DelegationIdIndexKey) delegationIndexKey() {}
func (this DelegationIdIndexKey) WithId(id string) DelegationIdIndexKey {
this.vs = []interface{}{id}
return this
}
type DelegationAccountAddressChainIdIndexKey struct {
vs []interface{}
}
func (x DelegationAccountAddressChainIdIndexKey) id() uint32 { return 1 }
func (x DelegationAccountAddressChainIdIndexKey) values() []interface{} { return x.vs }
func (x DelegationAccountAddressChainIdIndexKey) delegationIndexKey() {}
func (this DelegationAccountAddressChainIdIndexKey) WithAccountAddress(account_address string) DelegationAccountAddressChainIdIndexKey {
this.vs = []interface{}{account_address}
return this
}
func (this DelegationAccountAddressChainIdIndexKey) WithAccountAddressChainId(account_address string, chain_id string) DelegationAccountAddressChainIdIndexKey {
this.vs = []interface{}{account_address, chain_id}
return this
}
type DelegationControllerAccountLabelIndexKey struct {
vs []interface{}
}
func (x DelegationControllerAccountLabelIndexKey) id() uint32 { return 2 }
func (x DelegationControllerAccountLabelIndexKey) values() []interface{} { return x.vs }
func (x DelegationControllerAccountLabelIndexKey) delegationIndexKey() {}
func (this DelegationControllerAccountLabelIndexKey) WithController(controller string) DelegationControllerAccountLabelIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this DelegationControllerAccountLabelIndexKey) WithControllerAccountLabel(controller string, account_label string) DelegationControllerAccountLabelIndexKey {
this.vs = []interface{}{controller, account_label}
return this
}
type DelegationControllerChainIdIndexKey struct {
vs []interface{}
}
func (x DelegationControllerChainIdIndexKey) id() uint32 { return 3 }
func (x DelegationControllerChainIdIndexKey) values() []interface{} { return x.vs }
func (x DelegationControllerChainIdIndexKey) delegationIndexKey() {}
func (this DelegationControllerChainIdIndexKey) WithController(controller string) DelegationControllerChainIdIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this DelegationControllerChainIdIndexKey) WithControllerChainId(controller string, chain_id string) DelegationControllerChainIdIndexKey {
this.vs = []interface{}{controller, chain_id}
return this
}
type delegationTable struct {
table ormtable.Table
}
func (this delegationTable) Insert(ctx context.Context, delegation *Delegation) error {
return this.table.Insert(ctx, delegation)
}
func (this delegationTable) Update(ctx context.Context, delegation *Delegation) error {
return this.table.Update(ctx, delegation)
}
func (this delegationTable) Save(ctx context.Context, delegation *Delegation) error {
return this.table.Save(ctx, delegation)
}
func (this delegationTable) Delete(ctx context.Context, delegation *Delegation) error {
return this.table.Delete(ctx, delegation)
}
func (this delegationTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this delegationTable) Get(ctx context.Context, id string) (*Delegation, error) {
var delegation Delegation
found, err := this.table.PrimaryKey().Get(ctx, &delegation, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &delegation, nil
}
func (this delegationTable) HasByAccountAddressChainId(ctx context.Context, account_address string, chain_id string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
account_address,
chain_id,
)
}
func (this delegationTable) GetByAccountAddressChainId(ctx context.Context, account_address string, chain_id string) (*Delegation, error) {
var delegation Delegation
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &delegation,
account_address,
chain_id,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &delegation, nil
}
func (this delegationTable) HasByControllerAccountLabel(ctx context.Context, controller string, account_label string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
controller,
account_label,
)
}
func (this delegationTable) GetByControllerAccountLabel(ctx context.Context, controller string, account_label string) (*Delegation, error) {
var delegation Delegation
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &delegation,
controller,
account_label,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &delegation, nil
}
func (this delegationTable) List(ctx context.Context, prefixKey DelegationIndexKey, opts ...ormlist.Option) (DelegationIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return DelegationIterator{it}, err
}
func (this delegationTable) ListRange(ctx context.Context, from, to DelegationIndexKey, opts ...ormlist.Option) (DelegationIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return DelegationIterator{it}, err
}
func (this delegationTable) DeleteBy(ctx context.Context, prefixKey DelegationIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this delegationTable) DeleteRange(ctx context.Context, from, to DelegationIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this delegationTable) doNotImplement() {}
var _ DelegationTable = delegationTable{}
func NewDelegationTable(db ormtable.Schema) (DelegationTable, error) {
table := db.GetTable(&Delegation{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Delegation{}).ProtoReflect().Descriptor().FullName()))
}
return delegationTable{table}, nil
}
type ServiceRecordTable interface {
Insert(ctx context.Context, serviceRecord *ServiceRecord) error
Update(ctx context.Context, serviceRecord *ServiceRecord) error
Save(ctx context.Context, serviceRecord *ServiceRecord) error
Delete(ctx context.Context, serviceRecord *ServiceRecord) error
Has(ctx context.Context, id string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*ServiceRecord, error)
HasByOriginUri(ctx context.Context, origin_uri string) (found bool, err error)
// GetByOriginUri returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByOriginUri(ctx context.Context, origin_uri string) (*ServiceRecord, error)
HasByControllerOriginUri(ctx context.Context, controller string, origin_uri string) (found bool, err error)
// GetByControllerOriginUri returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerOriginUri(ctx context.Context, controller string, origin_uri string) (*ServiceRecord, error)
List(ctx context.Context, prefixKey ServiceRecordIndexKey, opts ...ormlist.Option) (ServiceRecordIterator, error)
ListRange(ctx context.Context, from, to ServiceRecordIndexKey, opts ...ormlist.Option) (ServiceRecordIterator, error)
DeleteBy(ctx context.Context, prefixKey ServiceRecordIndexKey) error
DeleteRange(ctx context.Context, from, to ServiceRecordIndexKey) error
doNotImplement()
}
type ServiceRecordIterator struct {
ormtable.Iterator
}
func (i ServiceRecordIterator) Value() (*ServiceRecord, error) {
var serviceRecord ServiceRecord
err := i.UnmarshalMessage(&serviceRecord)
return &serviceRecord, err
}
type ServiceRecordIndexKey interface {
id() uint32
values() []interface{}
serviceRecordIndexKey()
}
// primary key starting index..
type ServiceRecordPrimaryKey = ServiceRecordIdIndexKey
type ServiceRecordIdIndexKey struct {
vs []interface{}
}
func (x ServiceRecordIdIndexKey) id() uint32 { return 0 }
func (x ServiceRecordIdIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordIdIndexKey) serviceRecordIndexKey() {}
func (this ServiceRecordIdIndexKey) WithId(id string) ServiceRecordIdIndexKey {
this.vs = []interface{}{id}
return this
}
type ServiceRecordOriginUriIndexKey struct {
vs []interface{}
}
func (x ServiceRecordOriginUriIndexKey) id() uint32 { return 1 }
func (x ServiceRecordOriginUriIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordOriginUriIndexKey) serviceRecordIndexKey() {}
func (this ServiceRecordOriginUriIndexKey) WithOriginUri(origin_uri string) ServiceRecordOriginUriIndexKey {
this.vs = []interface{}{origin_uri}
return this
}
type ServiceRecordControllerOriginUriIndexKey struct {
vs []interface{}
}
func (x ServiceRecordControllerOriginUriIndexKey) id() uint32 { return 2 }
func (x ServiceRecordControllerOriginUriIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordControllerOriginUriIndexKey) serviceRecordIndexKey() {}
func (this ServiceRecordControllerOriginUriIndexKey) WithController(controller string) ServiceRecordControllerOriginUriIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this ServiceRecordControllerOriginUriIndexKey) WithControllerOriginUri(controller string, origin_uri string) ServiceRecordControllerOriginUriIndexKey {
this.vs = []interface{}{controller, origin_uri}
return this
}
type serviceRecordTable struct {
table ormtable.Table
}
func (this serviceRecordTable) Insert(ctx context.Context, serviceRecord *ServiceRecord) error {
return this.table.Insert(ctx, serviceRecord)
}
func (this serviceRecordTable) Update(ctx context.Context, serviceRecord *ServiceRecord) error {
return this.table.Update(ctx, serviceRecord)
}
func (this serviceRecordTable) Save(ctx context.Context, serviceRecord *ServiceRecord) error {
return this.table.Save(ctx, serviceRecord)
}
func (this serviceRecordTable) Delete(ctx context.Context, serviceRecord *ServiceRecord) error {
return this.table.Delete(ctx, serviceRecord)
}
func (this serviceRecordTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this serviceRecordTable) Get(ctx context.Context, id string) (*ServiceRecord, error) {
var serviceRecord ServiceRecord
found, err := this.table.PrimaryKey().Get(ctx, &serviceRecord, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &serviceRecord, nil
}
func (this serviceRecordTable) HasByOriginUri(ctx context.Context, origin_uri string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
origin_uri,
)
}
func (this serviceRecordTable) GetByOriginUri(ctx context.Context, origin_uri string) (*ServiceRecord, error) {
var serviceRecord ServiceRecord
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &serviceRecord,
origin_uri,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &serviceRecord, nil
}
func (this serviceRecordTable) HasByControllerOriginUri(ctx context.Context, controller string, origin_uri string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
controller,
origin_uri,
)
}
func (this serviceRecordTable) GetByControllerOriginUri(ctx context.Context, controller string, origin_uri string) (*ServiceRecord, error) {
var serviceRecord ServiceRecord
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &serviceRecord,
controller,
origin_uri,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &serviceRecord, nil
}
func (this serviceRecordTable) List(ctx context.Context, prefixKey ServiceRecordIndexKey, opts ...ormlist.Option) (ServiceRecordIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ServiceRecordIterator{it}, err
}
func (this serviceRecordTable) ListRange(ctx context.Context, from, to ServiceRecordIndexKey, opts ...ormlist.Option) (ServiceRecordIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ServiceRecordIterator{it}, err
}
func (this serviceRecordTable) DeleteBy(ctx context.Context, prefixKey ServiceRecordIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this serviceRecordTable) DeleteRange(ctx context.Context, from, to ServiceRecordIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this serviceRecordTable) doNotImplement() {}
var _ ServiceRecordTable = serviceRecordTable{}
func NewServiceRecordTable(db ormtable.Schema) (ServiceRecordTable, error) {
table := db.GetTable(&ServiceRecord{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&ServiceRecord{}).ProtoReflect().Descriptor().FullName()))
}
return serviceRecordTable{table}, nil
}
type StateStore interface {
AssertionTable() AssertionTable
AttestationTable() AttestationTable
ControllerTable() ControllerTable
DelegationTable() DelegationTable
ServiceRecordTable() ServiceRecordTable
doNotImplement()
}
type stateStore struct {
assertion AssertionTable
attestation AttestationTable
controller ControllerTable
delegation DelegationTable
serviceRecord ServiceRecordTable
}
func (x stateStore) AssertionTable() AssertionTable {
return x.assertion
}
func (x stateStore) AttestationTable() AttestationTable {
return x.attestation
}
func (x stateStore) ControllerTable() ControllerTable {
return x.controller
}
func (x stateStore) DelegationTable() DelegationTable {
return x.delegation
}
func (x stateStore) ServiceRecordTable() ServiceRecordTable {
return x.serviceRecord
}
func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) {
assertionTable, err := NewAssertionTable(db)
if err != nil {
return nil, err
}
attestationTable, err := NewAttestationTable(db)
if err != nil {
return nil, err
}
controllerTable, err := NewControllerTable(db)
if err != nil {
return nil, err
}
delegationTable, err := NewDelegationTable(db)
if err != nil {
return nil, err
}
serviceRecordTable, err := NewServiceRecordTable(db)
if err != nil {
return nil, err
}
return stateStore{
assertionTable,
attestationTable,
controllerTable,
delegationTable,
serviceRecordTable,
}, nil
}