Files
sonr/api/did/v1/state.cosmos_orm.go
T

1080 lines
37 KiB
Go
Raw Normal View History

2024-07-05 22:20:13 -04:00
// 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"
)
2024-09-11 15:10:54 -04:00
type AccountTable interface {
Insert(ctx context.Context, account *Account) error
Update(ctx context.Context, account *Account) error
Save(ctx context.Context, account *Account) error
Delete(ctx context.Context, account *Account) error
2024-07-06 03:02:45 -04:00
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.
2024-09-11 15:10:54 -04:00
Get(ctx context.Context, id string) (*Account, error)
HasByControllerLabel(ctx context.Context, controller string, label string) (found bool, err error)
// GetByControllerLabel returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerLabel(ctx context.Context, controller string, label string) (*Account, error)
HasByControllerAddress(ctx context.Context, controller string, address string) (found bool, err error)
// GetByControllerAddress returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerAddress(ctx context.Context, controller string, address string) (*Account, error)
HasByControllerChainCodeIndex(ctx context.Context, controller string, chain_code uint32, index uint32) (found bool, err error)
// GetByControllerChainCodeIndex returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerChainCodeIndex(ctx context.Context, controller string, chain_code uint32, index uint32) (*Account, error)
List(ctx context.Context, prefixKey AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error)
ListRange(ctx context.Context, from, to AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error)
DeleteBy(ctx context.Context, prefixKey AccountIndexKey) error
DeleteRange(ctx context.Context, from, to AccountIndexKey) error
2024-07-23 14:18:15 -04:00
Get(ctx context.Context, id string) (*Aliases, error)
HasBySubject(ctx context.Context, subject string) (found bool, err error)
// GetBySubject returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetBySubject(ctx context.Context, subject string) (*Aliases, error)
2024-07-23 14:18:15 -04:00
List(ctx context.Context, prefixKey AliasesIndexKey, opts ...ormlist.Option) (AliasesIterator, error)
ListRange(ctx context.Context, from, to AliasesIndexKey, opts ...ormlist.Option) (AliasesIterator, error)
DeleteBy(ctx context.Context, prefixKey AliasesIndexKey) error
DeleteRange(ctx context.Context, from, to AliasesIndexKey) error
2024-07-06 03:02:45 -04:00
doNotImplement()
}
2024-09-11 15:10:54 -04:00
type AccountIterator struct {
2024-07-06 03:02:45 -04:00
ormtable.Iterator
}
2024-09-11 15:10:54 -04:00
func (i AccountIterator) Value() (*Account, error) {
var account Account
err := i.UnmarshalMessage(&account)
return &account, err
2024-07-06 03:02:45 -04:00
}
2024-09-11 15:10:54 -04:00
type AccountIndexKey interface {
2024-07-06 03:02:45 -04:00
id() uint32
values() []interface{}
2024-09-11 15:10:54 -04:00
accountIndexKey()
2024-07-06 03:02:45 -04:00
}
// primary key starting index..
2024-09-11 15:10:54 -04:00
type AccountPrimaryKey = AccountIdIndexKey
2024-07-06 03:02:45 -04:00
2024-09-11 15:10:54 -04:00
type AccountIdIndexKey struct {
2024-07-06 03:02:45 -04:00
vs []interface{}
}
2024-09-11 15:10:54 -04:00
func (x AccountIdIndexKey) id() uint32 { return 0 }
func (x AccountIdIndexKey) values() []interface{} { return x.vs }
func (x AccountIdIndexKey) accountIndexKey() {}
2024-07-06 03:02:45 -04:00
2024-09-11 15:10:54 -04:00
func (this AccountIdIndexKey) WithId(id string) AccountIdIndexKey {
2024-07-06 03:02:45 -04:00
this.vs = []interface{}{id}
return this
}
2024-09-11 15:10:54 -04:00
type AccountControllerLabelIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-11 15:10:54 -04:00
func (x AccountControllerLabelIndexKey) id() uint32 { return 1 }
func (x AccountControllerLabelIndexKey) values() []interface{} { return x.vs }
func (x AccountControllerLabelIndexKey) accountIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-11 15:10:54 -04:00
func (this AccountControllerLabelIndexKey) WithController(controller string) AccountControllerLabelIndexKey {
this.vs = []interface{}{controller}
type AliasesSubjectIndexKey struct {
2024-07-26 12:14:20 -04:00
vs []interface{}
}
func (x AliasesSubjectIndexKey) id() uint32 { return 1 }
func (x AliasesSubjectIndexKey) values() []interface{} { return x.vs }
func (x AliasesSubjectIndexKey) aliasesIndexKey() {}
2024-07-26 12:14:20 -04:00
func (this AliasesSubjectIndexKey) WithSubject(subject string) AliasesSubjectIndexKey {
this.vs = []interface{}{subject}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-11 15:10:54 -04:00
func (this AccountControllerLabelIndexKey) WithControllerLabel(controller string, label string) AccountControllerLabelIndexKey {
this.vs = []interface{}{controller, label}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-11 15:10:54 -04:00
type AccountControllerAddressIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-11 15:10:54 -04:00
func (x AccountControllerAddressIndexKey) id() uint32 { return 2 }
func (x AccountControllerAddressIndexKey) values() []interface{} { return x.vs }
func (x AccountControllerAddressIndexKey) accountIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-11 15:10:54 -04:00
func (this AccountControllerAddressIndexKey) WithController(controller string) AccountControllerAddressIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{controller}
return this
}
2024-09-11 15:10:54 -04:00
func (this AccountControllerAddressIndexKey) WithControllerAddress(controller string, address string) AccountControllerAddressIndexKey {
this.vs = []interface{}{controller, address}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-11 15:10:54 -04:00
type AccountControllerChainCodeIndexIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-11 15:10:54 -04:00
func (x AccountControllerChainCodeIndexIndexKey) id() uint32 { return 3 }
func (x AccountControllerChainCodeIndexIndexKey) values() []interface{} { return x.vs }
func (x AccountControllerChainCodeIndexIndexKey) accountIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-11 15:10:54 -04:00
func (this AccountControllerChainCodeIndexIndexKey) WithController(controller string) AccountControllerChainCodeIndexIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{controller}
return this
}
2024-09-11 15:10:54 -04:00
func (this AccountControllerChainCodeIndexIndexKey) WithControllerChainCode(controller string, chain_code uint32) AccountControllerChainCodeIndexIndexKey {
this.vs = []interface{}{controller, chain_code}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-11 15:10:54 -04:00
func (this AccountControllerChainCodeIndexIndexKey) WithControllerChainCodeIndex(controller string, chain_code uint32, index uint32) AccountControllerChainCodeIndexIndexKey {
this.vs = []interface{}{controller, chain_code, index}
return this
}
type accountTable struct {
2024-07-06 03:02:45 -04:00
table ormtable.Table
}
2024-09-11 15:10:54 -04:00
func (this accountTable) Insert(ctx context.Context, account *Account) error {
return this.table.Insert(ctx, account)
2024-07-06 03:02:45 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) Update(ctx context.Context, account *Account) error {
return this.table.Update(ctx, account)
2024-07-06 03:02:45 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) Save(ctx context.Context, account *Account) error {
return this.table.Save(ctx, account)
2024-07-06 03:02:45 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) Delete(ctx context.Context, account *Account) error {
return this.table.Delete(ctx, account)
2024-07-06 03:02:45 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) Has(ctx context.Context, id string) (found bool, err error) {
2024-07-06 03:02:45 -04:00
return this.table.PrimaryKey().Has(ctx, id)
}
2024-09-11 15:10:54 -04:00
func (this accountTable) Get(ctx context.Context, id string) (*Account, error) {
var account Account
found, err := this.table.PrimaryKey().Get(ctx, &account, id)
2024-07-06 03:02:45 -04:00
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-11 15:10:54 -04:00
return &account, nil
2024-07-06 03:02:45 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) HasByControllerLabel(ctx context.Context, controller string, label string) (found bool, err error) {
2024-09-05 01:24:57 -04:00
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
controller,
2024-09-11 15:10:54 -04:00
label,
2024-09-05 01:24:57 -04:00
)
}
2024-09-11 15:10:54 -04:00
func (this accountTable) GetByControllerLabel(ctx context.Context, controller string, label string) (*Account, error) {
var account Account
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &account,
2024-09-05 01:24:57 -04:00
controller,
2024-09-11 15:10:54 -04:00
label,
func (this aliasesTable) HasBySubject(ctx context.Context, subject string) (found bool, err error) {
2024-07-26 12:14:20 -04:00
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
subject,
2024-07-26 12:14:20 -04:00
)
}
func (this aliasesTable) GetBySubject(ctx context.Context, subject string) (*Aliases, error) {
2024-07-26 12:14:20 -04:00
var aliases Aliases
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &aliases,
subject,
2024-09-05 01:24:57 -04:00
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-11 15:10:54 -04:00
return &account, nil
2024-09-05 01:24:57 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) HasByControllerAddress(ctx context.Context, controller string, address string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
2024-09-05 01:24:57 -04:00
controller,
2024-09-11 15:10:54 -04:00
address,
2024-09-05 01:24:57 -04:00
)
}
2024-09-11 15:10:54 -04:00
func (this accountTable) GetByControllerAddress(ctx context.Context, controller string, address string) (*Account, error) {
var account Account
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &account,
2024-09-05 01:24:57 -04:00
controller,
2024-09-11 15:10:54 -04:00
address,
2024-08-31 16:54:16 -04:00
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-11 15:10:54 -04:00
return &account, nil
2024-08-31 16:54:16 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) HasByControllerChainCodeIndex(ctx context.Context, controller string, chain_code uint32, index uint32) (found bool, err error) {
return this.table.GetIndexByID(3).(ormtable.UniqueIndex).Has(ctx,
2024-09-05 01:24:57 -04:00
controller,
2024-09-11 15:10:54 -04:00
chain_code,
index,
2024-09-05 01:24:57 -04:00
)
}
2024-09-11 15:10:54 -04:00
func (this accountTable) GetByControllerChainCodeIndex(ctx context.Context, controller string, chain_code uint32, index uint32) (*Account, error) {
var account Account
found, err := this.table.GetIndexByID(3).(ormtable.UniqueIndex).Get(ctx, &account,
2024-09-05 01:24:57 -04:00
controller,
2024-09-11 15:10:54 -04:00
chain_code,
index,
2024-09-05 01:24:57 -04:00
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-11 15:10:54 -04:00
return &account, nil
2024-09-05 01:24:57 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) List(ctx context.Context, prefixKey AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error) {
2024-07-05 22:20:13 -04:00
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
2024-09-11 15:10:54 -04:00
return AccountIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) ListRange(ctx context.Context, from, to AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error) {
2024-07-05 22:20:13 -04:00
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
2024-09-11 15:10:54 -04:00
return AccountIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (this accountTable) DeleteBy(ctx context.Context, prefixKey AccountIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
2024-09-11 15:10:54 -04:00
func (this accountTable) DeleteRange(ctx context.Context, from, to AccountIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
2024-09-11 15:10:54 -04:00
func (this accountTable) doNotImplement() {}
2024-07-05 22:20:13 -04:00
2024-09-11 15:10:54 -04:00
var _ AccountTable = accountTable{}
2024-07-05 22:20:13 -04:00
2024-09-11 15:10:54 -04:00
func NewAccountTable(db ormtable.Schema) (AccountTable, error) {
table := db.GetTable(&Account{})
2024-07-05 22:20:13 -04:00
if table == nil {
2024-09-11 15:10:54 -04:00
return nil, ormerrors.TableNotFound.Wrap(string((&Account{}).ProtoReflect().Descriptor().FullName()))
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
return accountTable{table}, nil
2024-07-05 22:20:13 -04:00
}
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)
2024-09-05 01:24:57 -04:00
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)
2024-07-05 22:20:13 -04:00
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
}
2024-09-05 01:24:57 -04:00
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
}
2024-07-05 22:20:13 -04:00
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
}
2024-09-05 01:24:57 -04:00
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
}
2024-07-05 22:20:13 -04:00
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
}
2024-09-11 15:10:54 -04:00
type ProofTable interface {
Insert(ctx context.Context, proof *Proof) error
Update(ctx context.Context, proof *Proof) error
Save(ctx context.Context, proof *Proof) error
Delete(ctx context.Context, proof *Proof) error
2024-07-05 22:20:13 -04:00
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.
2024-09-11 15:10:54 -04:00
Get(ctx context.Context, id string) (*Proof, error)
HasByControllerIssuerProperty(ctx context.Context, controller string, issuer string, property string) (found bool, err error)
// GetByControllerIssuerProperty returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerIssuerProperty(ctx context.Context, controller string, issuer string, property string) (*Proof, error)
List(ctx context.Context, prefixKey ProofIndexKey, opts ...ormlist.Option) (ProofIterator, error)
ListRange(ctx context.Context, from, to ProofIndexKey, opts ...ormlist.Option) (ProofIterator, error)
DeleteBy(ctx context.Context, prefixKey ProofIndexKey) error
DeleteRange(ctx context.Context, from, to ProofIndexKey) error
2024-07-05 22:20:13 -04:00
doNotImplement()
}
2024-09-11 15:10:54 -04:00
type ProofIterator struct {
2024-07-05 22:20:13 -04:00
ormtable.Iterator
}
2024-09-11 15:10:54 -04:00
func (i ProofIterator) Value() (*Proof, error) {
var proof Proof
err := i.UnmarshalMessage(&proof)
return &proof, err
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
type ProofIndexKey interface {
2024-07-05 22:20:13 -04:00
id() uint32
values() []interface{}
2024-09-11 15:10:54 -04:00
proofIndexKey()
2024-07-05 22:20:13 -04:00
}
// primary key starting index..
2024-09-11 15:10:54 -04:00
type ProofPrimaryKey = ProofIdIndexKey
2024-07-05 22:20:13 -04:00
2024-09-11 15:10:54 -04:00
type ProofIdIndexKey struct {
2024-07-05 22:20:13 -04:00
vs []interface{}
}
2024-09-11 15:10:54 -04:00
func (x ProofIdIndexKey) id() uint32 { return 0 }
func (x ProofIdIndexKey) values() []interface{} { return x.vs }
func (x ProofIdIndexKey) proofIndexKey() {}
2024-07-05 22:20:13 -04:00
2024-09-11 15:10:54 -04:00
func (this ProofIdIndexKey) WithId(id string) ProofIdIndexKey {
2024-07-05 22:20:13 -04:00
this.vs = []interface{}{id}
return this
}
2024-09-11 15:10:54 -04:00
type ProofControllerIssuerPropertyIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-11 15:10:54 -04:00
func (x ProofControllerIssuerPropertyIndexKey) id() uint32 { return 1 }
func (x ProofControllerIssuerPropertyIndexKey) values() []interface{} { return x.vs }
func (x ProofControllerIssuerPropertyIndexKey) proofIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-11 15:10:54 -04:00
func (this ProofControllerIssuerPropertyIndexKey) WithController(controller string) ProofControllerIssuerPropertyIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{controller}
return this
}
2024-09-11 15:10:54 -04:00
func (this ProofControllerIssuerPropertyIndexKey) WithControllerIssuer(controller string, issuer string) ProofControllerIssuerPropertyIndexKey {
this.vs = []interface{}{controller, issuer}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-11 15:10:54 -04:00
func (this ProofControllerIssuerPropertyIndexKey) WithControllerIssuerProperty(controller string, issuer string, property string) ProofControllerIssuerPropertyIndexKey {
this.vs = []interface{}{controller, issuer, property}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-11 15:10:54 -04:00
type proofTable struct {
2024-07-05 22:20:13 -04:00
table ormtable.Table
}
2024-09-11 15:10:54 -04:00
func (this proofTable) Insert(ctx context.Context, proof *Proof) error {
return this.table.Insert(ctx, proof)
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (this proofTable) Update(ctx context.Context, proof *Proof) error {
return this.table.Update(ctx, proof)
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (this proofTable) Save(ctx context.Context, proof *Proof) error {
return this.table.Save(ctx, proof)
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (this proofTable) Delete(ctx context.Context, proof *Proof) error {
return this.table.Delete(ctx, proof)
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (this proofTable) Has(ctx context.Context, id string) (found bool, err error) {
2024-07-05 22:20:13 -04:00
return this.table.PrimaryKey().Has(ctx, id)
}
2024-09-11 15:10:54 -04:00
func (this proofTable) Get(ctx context.Context, id string) (*Proof, error) {
var proof Proof
found, err := this.table.PrimaryKey().Get(ctx, &proof, id)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-11 15:10:54 -04:00
return &proof, nil
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (this proofTable) HasByControllerIssuerProperty(ctx context.Context, controller string, issuer string, property string) (found bool, err error) {
2024-09-05 01:24:57 -04:00
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
controller,
2024-09-11 15:10:54 -04:00
issuer,
property,
2024-09-05 01:24:57 -04:00
)
}
2024-09-11 15:10:54 -04:00
func (this proofTable) GetByControllerIssuerProperty(ctx context.Context, controller string, issuer string, property string) (*Proof, error) {
var proof Proof
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &proof,
2024-09-05 01:24:57 -04:00
controller,
2024-09-11 15:10:54 -04:00
issuer,
property,
2024-09-05 01:24:57 -04:00
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-11 15:10:54 -04:00
return &proof, nil
2024-09-05 01:24:57 -04:00
}
2024-09-11 15:10:54 -04:00
func (this proofTable) List(ctx context.Context, prefixKey ProofIndexKey, opts ...ormlist.Option) (ProofIterator, error) {
2024-07-05 22:20:13 -04:00
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
2024-09-11 15:10:54 -04:00
return ProofIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (this proofTable) ListRange(ctx context.Context, from, to ProofIndexKey, opts ...ormlist.Option) (ProofIterator, error) {
2024-07-05 22:20:13 -04:00
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
2024-09-11 15:10:54 -04:00
return ProofIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (this proofTable) DeleteBy(ctx context.Context, prefixKey ProofIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
2024-09-11 15:10:54 -04:00
func (this proofTable) DeleteRange(ctx context.Context, from, to ProofIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
2024-09-11 15:10:54 -04:00
func (this proofTable) doNotImplement() {}
2024-07-05 22:20:13 -04:00
2024-09-11 15:10:54 -04:00
var _ ProofTable = proofTable{}
2024-07-05 22:20:13 -04:00
2024-09-11 15:10:54 -04:00
func NewProofTable(db ormtable.Schema) (ProofTable, error) {
table := db.GetTable(&Proof{})
2024-07-05 22:20:13 -04:00
if table == nil {
2024-09-11 15:10:54 -04:00
return nil, ormerrors.TableNotFound.Wrap(string((&Proof{}).ProtoReflect().Descriptor().FullName()))
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
return proofTable{table}, nil
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
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
2024-07-05 22:20:13 -04:00
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.
2024-09-05 01:24:57 -04:00
Get(ctx context.Context, id string) (*ServiceRecord, error)
2024-09-11 15:10:54 -04:00
HasByOrigin(ctx context.Context, origin string) (found bool, err error)
// GetByOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByOrigin(ctx context.Context, origin string) (*ServiceRecord, error)
HasByAuthorityOrigin(ctx context.Context, authority string, origin string) (found bool, err error)
// GetByAuthorityOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByAuthorityOrigin(ctx context.Context, authority string, origin string) (*ServiceRecord, error)
2024-09-05 01:24:57 -04:00
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
2024-07-05 22:20:13 -04:00
doNotImplement()
}
2024-09-05 01:24:57 -04:00
type ServiceRecordIterator struct {
2024-07-05 22:20:13 -04:00
ormtable.Iterator
}
2024-09-05 01:24:57 -04:00
func (i ServiceRecordIterator) Value() (*ServiceRecord, error) {
var serviceRecord ServiceRecord
err := i.UnmarshalMessage(&serviceRecord)
return &serviceRecord, err
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
type ServiceRecordIndexKey interface {
2024-07-05 22:20:13 -04:00
id() uint32
values() []interface{}
2024-09-05 01:24:57 -04:00
serviceRecordIndexKey()
2024-07-05 22:20:13 -04:00
}
// primary key starting index..
2024-09-05 01:24:57 -04:00
type ServiceRecordPrimaryKey = ServiceRecordIdIndexKey
2024-07-05 22:20:13 -04:00
2024-09-05 01:24:57 -04:00
type ServiceRecordIdIndexKey struct {
2024-07-05 22:20:13 -04:00
vs []interface{}
}
2024-09-05 01:24:57 -04:00
func (x ServiceRecordIdIndexKey) id() uint32 { return 0 }
func (x ServiceRecordIdIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordIdIndexKey) serviceRecordIndexKey() {}
2024-07-05 22:20:13 -04:00
2024-09-05 01:24:57 -04:00
func (this ServiceRecordIdIndexKey) WithId(id string) ServiceRecordIdIndexKey {
2024-07-05 22:20:13 -04:00
this.vs = []interface{}{id}
return this
}
2024-09-11 15:10:54 -04:00
type ServiceRecordOriginIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-11 15:10:54 -04:00
func (x ServiceRecordOriginIndexKey) id() uint32 { return 1 }
func (x ServiceRecordOriginIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordOriginIndexKey) serviceRecordIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-11 15:10:54 -04:00
func (this ServiceRecordOriginIndexKey) WithOrigin(origin string) ServiceRecordOriginIndexKey {
this.vs = []interface{}{origin}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-11 15:10:54 -04:00
type ServiceRecordAuthorityOriginIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-11 15:10:54 -04:00
func (x ServiceRecordAuthorityOriginIndexKey) id() uint32 { return 2 }
func (x ServiceRecordAuthorityOriginIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordAuthorityOriginIndexKey) serviceRecordIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-11 15:10:54 -04:00
func (this ServiceRecordAuthorityOriginIndexKey) WithAuthority(authority string) ServiceRecordAuthorityOriginIndexKey {
this.vs = []interface{}{authority}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-11 15:10:54 -04:00
func (this ServiceRecordAuthorityOriginIndexKey) WithAuthorityOrigin(authority string, origin string) ServiceRecordAuthorityOriginIndexKey {
this.vs = []interface{}{authority, origin}
2024-09-05 01:24:57 -04:00
return this
}
type serviceRecordTable struct {
2024-07-05 22:20:13 -04:00
table ormtable.Table
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) Insert(ctx context.Context, serviceRecord *ServiceRecord) error {
return this.table.Insert(ctx, serviceRecord)
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) Update(ctx context.Context, serviceRecord *ServiceRecord) error {
return this.table.Update(ctx, serviceRecord)
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) Save(ctx context.Context, serviceRecord *ServiceRecord) error {
return this.table.Save(ctx, serviceRecord)
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) Delete(ctx context.Context, serviceRecord *ServiceRecord) error {
return this.table.Delete(ctx, serviceRecord)
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) Has(ctx context.Context, id string) (found bool, err error) {
2024-07-05 22:20:13 -04:00
return this.table.PrimaryKey().Has(ctx, id)
}
2024-09-05 01:24:57 -04:00
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
}
2024-09-11 15:10:54 -04:00
func (this serviceRecordTable) HasByOrigin(ctx context.Context, origin string) (found bool, err error) {
2024-09-05 01:24:57 -04:00
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
2024-09-11 15:10:54 -04:00
origin,
2024-09-05 01:24:57 -04:00
)
}
2024-09-11 15:10:54 -04:00
func (this serviceRecordTable) GetByOrigin(ctx context.Context, origin string) (*ServiceRecord, error) {
2024-09-05 01:24:57 -04:00
var serviceRecord ServiceRecord
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &serviceRecord,
2024-09-11 15:10:54 -04:00
origin,
2024-09-05 01:24:57 -04:00
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &serviceRecord, nil
}
2024-09-11 15:10:54 -04:00
func (this serviceRecordTable) HasByAuthorityOrigin(ctx context.Context, authority string, origin string) (found bool, err error) {
2024-09-05 01:24:57 -04:00
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
2024-09-11 15:10:54 -04:00
authority,
origin,
2024-09-05 01:24:57 -04:00
)
}
2024-09-11 15:10:54 -04:00
func (this serviceRecordTable) GetByAuthorityOrigin(ctx context.Context, authority string, origin string) (*ServiceRecord, error) {
2024-09-05 01:24:57 -04:00
var serviceRecord ServiceRecord
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &serviceRecord,
2024-09-11 15:10:54 -04:00
authority,
origin,
2024-09-05 01:24:57 -04:00
)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-05 01:24:57 -04:00
return &serviceRecord, nil
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) List(ctx context.Context, prefixKey ServiceRecordIndexKey, opts ...ormlist.Option) (ServiceRecordIterator, error) {
2024-07-05 22:20:13 -04:00
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
2024-09-05 01:24:57 -04:00
return ServiceRecordIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) ListRange(ctx context.Context, from, to ServiceRecordIndexKey, opts ...ormlist.Option) (ServiceRecordIterator, error) {
2024-07-05 22:20:13 -04:00
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
2024-09-05 01:24:57 -04:00
return ServiceRecordIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) DeleteBy(ctx context.Context, prefixKey ServiceRecordIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) DeleteRange(ctx context.Context, from, to ServiceRecordIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
2024-09-05 01:24:57 -04:00
func (this serviceRecordTable) doNotImplement() {}
2024-07-05 22:20:13 -04:00
2024-09-05 01:24:57 -04:00
var _ ServiceRecordTable = serviceRecordTable{}
2024-07-05 22:20:13 -04:00
2024-09-05 01:24:57 -04:00
func NewServiceRecordTable(db ormtable.Schema) (ServiceRecordTable, error) {
table := db.GetTable(&ServiceRecord{})
2024-07-05 22:20:13 -04:00
if table == nil {
2024-09-05 01:24:57 -04:00
return nil, ormerrors.TableNotFound.Wrap(string((&ServiceRecord{}).ProtoReflect().Descriptor().FullName()))
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
return serviceRecordTable{table}, nil
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
type VerificationMethodTable interface {
Insert(ctx context.Context, verificationMethod *VerificationMethod) error
Update(ctx context.Context, verificationMethod *VerificationMethod) error
Save(ctx context.Context, verificationMethod *VerificationMethod) error
Delete(ctx context.Context, verificationMethod *VerificationMethod) 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) (*VerificationMethod, error)
HasByControllerMethodIssuerSubject(ctx context.Context, controller string, method DIDNamespace, issuer string, subject string) (found bool, err error)
// GetByControllerMethodIssuerSubject returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerMethodIssuerSubject(ctx context.Context, controller string, method DIDNamespace, issuer string, subject string) (*VerificationMethod, error)
List(ctx context.Context, prefixKey VerificationMethodIndexKey, opts ...ormlist.Option) (VerificationMethodIterator, error)
ListRange(ctx context.Context, from, to VerificationMethodIndexKey, opts ...ormlist.Option) (VerificationMethodIterator, error)
DeleteBy(ctx context.Context, prefixKey VerificationMethodIndexKey) error
DeleteRange(ctx context.Context, from, to VerificationMethodIndexKey) error
doNotImplement()
}
type VerificationMethodIterator struct {
ormtable.Iterator
}
func (i VerificationMethodIterator) Value() (*VerificationMethod, error) {
var verificationMethod VerificationMethod
err := i.UnmarshalMessage(&verificationMethod)
return &verificationMethod, err
}
type VerificationMethodIndexKey interface {
id() uint32
values() []interface{}
verificationMethodIndexKey()
}
// primary key starting index..
type VerificationMethodPrimaryKey = VerificationMethodIdIndexKey
type VerificationMethodIdIndexKey struct {
vs []interface{}
}
func (x VerificationMethodIdIndexKey) id() uint32 { return 0 }
func (x VerificationMethodIdIndexKey) values() []interface{} { return x.vs }
func (x VerificationMethodIdIndexKey) verificationMethodIndexKey() {}
func (this VerificationMethodIdIndexKey) WithId(id string) VerificationMethodIdIndexKey {
this.vs = []interface{}{id}
return this
}
type VerificationMethodControllerMethodIssuerSubjectIndexKey struct {
vs []interface{}
}
func (x VerificationMethodControllerMethodIssuerSubjectIndexKey) id() uint32 { return 1 }
func (x VerificationMethodControllerMethodIssuerSubjectIndexKey) values() []interface{} { return x.vs }
func (x VerificationMethodControllerMethodIssuerSubjectIndexKey) verificationMethodIndexKey() {}
func (this VerificationMethodControllerMethodIssuerSubjectIndexKey) WithController(controller string) VerificationMethodControllerMethodIssuerSubjectIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this VerificationMethodControllerMethodIssuerSubjectIndexKey) WithControllerMethod(controller string, method DIDNamespace) VerificationMethodControllerMethodIssuerSubjectIndexKey {
this.vs = []interface{}{controller, method}
return this
}
func (this VerificationMethodControllerMethodIssuerSubjectIndexKey) WithControllerMethodIssuer(controller string, method DIDNamespace, issuer string) VerificationMethodControllerMethodIssuerSubjectIndexKey {
this.vs = []interface{}{controller, method, issuer}
return this
}
func (this VerificationMethodControllerMethodIssuerSubjectIndexKey) WithControllerMethodIssuerSubject(controller string, method DIDNamespace, issuer string, subject string) VerificationMethodControllerMethodIssuerSubjectIndexKey {
this.vs = []interface{}{controller, method, issuer, subject}
return this
}
type verificationMethodTable struct {
table ormtable.Table
}
func (this verificationMethodTable) Insert(ctx context.Context, verificationMethod *VerificationMethod) error {
return this.table.Insert(ctx, verificationMethod)
}
func (this verificationMethodTable) Update(ctx context.Context, verificationMethod *VerificationMethod) error {
return this.table.Update(ctx, verificationMethod)
}
func (this verificationMethodTable) Save(ctx context.Context, verificationMethod *VerificationMethod) error {
return this.table.Save(ctx, verificationMethod)
}
func (this verificationMethodTable) Delete(ctx context.Context, verificationMethod *VerificationMethod) error {
return this.table.Delete(ctx, verificationMethod)
}
func (this verificationMethodTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this verificationMethodTable) Get(ctx context.Context, id string) (*VerificationMethod, error) {
var verificationMethod VerificationMethod
found, err := this.table.PrimaryKey().Get(ctx, &verificationMethod, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &verificationMethod, nil
}
func (this verificationMethodTable) HasByControllerMethodIssuerSubject(ctx context.Context, controller string, method DIDNamespace, issuer string, subject string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
controller,
method,
issuer,
subject,
)
}
func (this verificationMethodTable) GetByControllerMethodIssuerSubject(ctx context.Context, controller string, method DIDNamespace, issuer string, subject string) (*VerificationMethod, error) {
var verificationMethod VerificationMethod
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &verificationMethod,
controller,
method,
issuer,
subject,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &verificationMethod, nil
}
func (this verificationMethodTable) List(ctx context.Context, prefixKey VerificationMethodIndexKey, opts ...ormlist.Option) (VerificationMethodIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return VerificationMethodIterator{it}, err
}
func (this verificationMethodTable) ListRange(ctx context.Context, from, to VerificationMethodIndexKey, opts ...ormlist.Option) (VerificationMethodIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return VerificationMethodIterator{it}, err
}
func (this verificationMethodTable) DeleteBy(ctx context.Context, prefixKey VerificationMethodIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this verificationMethodTable) DeleteRange(ctx context.Context, from, to VerificationMethodIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this verificationMethodTable) doNotImplement() {}
var _ VerificationMethodTable = verificationMethodTable{}
func NewVerificationMethodTable(db ormtable.Schema) (VerificationMethodTable, error) {
table := db.GetTable(&VerificationMethod{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&VerificationMethod{}).ProtoReflect().Descriptor().FullName()))
}
return verificationMethodTable{table}, nil
}
2024-07-05 22:20:13 -04:00
type StateStore interface {
2024-09-11 15:10:54 -04:00
AccountTable() AccountTable
2024-07-05 22:20:13 -04:00
ControllerTable() ControllerTable
2024-09-11 15:10:54 -04:00
ProofTable() ProofTable
2024-09-05 01:24:57 -04:00
ServiceRecordTable() ServiceRecordTable
2024-09-11 15:10:54 -04:00
VerificationMethodTable() VerificationMethodTable
2024-07-05 22:20:13 -04:00
doNotImplement()
}
type stateStore struct {
2024-09-11 15:10:54 -04:00
account AccountTable
controller ControllerTable
proof ProofTable
serviceRecord ServiceRecordTable
verificationMethod VerificationMethodTable
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (x stateStore) AccountTable() AccountTable {
return x.account
2024-07-05 22:20:13 -04:00
}
func (x stateStore) ControllerTable() ControllerTable {
return x.controller
}
2024-09-11 15:10:54 -04:00
func (x stateStore) ProofTable() ProofTable {
return x.proof
2024-07-05 22:20:13 -04:00
}
2024-09-05 01:24:57 -04:00
func (x stateStore) ServiceRecordTable() ServiceRecordTable {
return x.serviceRecord
2024-07-05 22:20:13 -04:00
}
2024-09-11 15:10:54 -04:00
func (x stateStore) VerificationMethodTable() VerificationMethodTable {
return x.verificationMethod
}
2024-07-05 22:20:13 -04:00
func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) {
2024-09-11 15:10:54 -04:00
accountTable, err := NewAccountTable(db)
2024-07-06 03:02:45 -04:00
if err != nil {
return nil, err
}
2024-09-11 15:10:54 -04:00
controllerTable, err := NewControllerTable(db)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
2024-09-11 15:10:54 -04:00
proofTable, err := NewProofTable(db)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
2024-09-11 15:10:54 -04:00
serviceRecordTable, err := NewServiceRecordTable(db)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
2024-09-11 15:10:54 -04:00
verificationMethodTable, err := NewVerificationMethodTable(db)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
return stateStore{
2024-09-11 15:10:54 -04:00
accountTable,
2024-07-05 22:20:13 -04:00
controllerTable,
2024-09-11 15:10:54 -04:00
proofTable,
2024-09-05 01:24:57 -04:00
serviceRecordTable,
2024-09-11 15:10:54 -04:00
verificationMethodTable,
2024-07-05 22:20:13 -04:00
}, nil
}