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

1080 lines
37 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 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
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) (*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
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)
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
doNotImplement()
}
type AccountIterator struct {
ormtable.Iterator
}
func (i AccountIterator) Value() (*Account, error) {
var account Account
err := i.UnmarshalMessage(&account)
return &account, err
}
type AccountIndexKey interface {
id() uint32
values() []interface{}
accountIndexKey()
}
// primary key starting index..
type AccountPrimaryKey = AccountIdIndexKey
type AccountIdIndexKey struct {
vs []interface{}
}
func (x AccountIdIndexKey) id() uint32 { return 0 }
func (x AccountIdIndexKey) values() []interface{} { return x.vs }
func (x AccountIdIndexKey) accountIndexKey() {}
func (this AccountIdIndexKey) WithId(id string) AccountIdIndexKey {
this.vs = []interface{}{id}
return this
}
type AccountControllerLabelIndexKey struct {
vs []interface{}
}
func (x AccountControllerLabelIndexKey) id() uint32 { return 1 }
func (x AccountControllerLabelIndexKey) values() []interface{} { return x.vs }
func (x AccountControllerLabelIndexKey) accountIndexKey() {}
func (this AccountControllerLabelIndexKey) WithController(controller string) AccountControllerLabelIndexKey {
this.vs = []interface{}{controller}
type AliasesSubjectIndexKey struct {
vs []interface{}
}
func (x AliasesSubjectIndexKey) id() uint32 { return 1 }
func (x AliasesSubjectIndexKey) values() []interface{} { return x.vs }
func (x AliasesSubjectIndexKey) aliasesIndexKey() {}
func (this AliasesSubjectIndexKey) WithSubject(subject string) AliasesSubjectIndexKey {
this.vs = []interface{}{subject}
return this
}
func (this AccountControllerLabelIndexKey) WithControllerLabel(controller string, label string) AccountControllerLabelIndexKey {
this.vs = []interface{}{controller, label}
return this
}
type AccountControllerAddressIndexKey struct {
vs []interface{}
}
func (x AccountControllerAddressIndexKey) id() uint32 { return 2 }
func (x AccountControllerAddressIndexKey) values() []interface{} { return x.vs }
func (x AccountControllerAddressIndexKey) accountIndexKey() {}
func (this AccountControllerAddressIndexKey) WithController(controller string) AccountControllerAddressIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this AccountControllerAddressIndexKey) WithControllerAddress(controller string, address string) AccountControllerAddressIndexKey {
this.vs = []interface{}{controller, address}
return this
}
type AccountControllerChainCodeIndexIndexKey struct {
vs []interface{}
}
func (x AccountControllerChainCodeIndexIndexKey) id() uint32 { return 3 }
func (x AccountControllerChainCodeIndexIndexKey) values() []interface{} { return x.vs }
func (x AccountControllerChainCodeIndexIndexKey) accountIndexKey() {}
func (this AccountControllerChainCodeIndexIndexKey) WithController(controller string) AccountControllerChainCodeIndexIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this AccountControllerChainCodeIndexIndexKey) WithControllerChainCode(controller string, chain_code uint32) AccountControllerChainCodeIndexIndexKey {
this.vs = []interface{}{controller, chain_code}
return this
}
func (this AccountControllerChainCodeIndexIndexKey) WithControllerChainCodeIndex(controller string, chain_code uint32, index uint32) AccountControllerChainCodeIndexIndexKey {
this.vs = []interface{}{controller, chain_code, index}
return this
}
type accountTable struct {
table ormtable.Table
}
func (this accountTable) Insert(ctx context.Context, account *Account) error {
return this.table.Insert(ctx, account)
}
func (this accountTable) Update(ctx context.Context, account *Account) error {
return this.table.Update(ctx, account)
}
func (this accountTable) Save(ctx context.Context, account *Account) error {
return this.table.Save(ctx, account)
}
func (this accountTable) Delete(ctx context.Context, account *Account) error {
return this.table.Delete(ctx, account)
}
func (this accountTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this accountTable) Get(ctx context.Context, id string) (*Account, error) {
var account Account
found, err := this.table.PrimaryKey().Get(ctx, &account, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &account, nil
}
func (this accountTable) HasByControllerLabel(ctx context.Context, controller string, label string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
controller,
label,
)
}
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,
controller,
label,
func (this aliasesTable) HasBySubject(ctx context.Context, subject string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
subject,
)
}
func (this aliasesTable) GetBySubject(ctx context.Context, subject string) (*Aliases, error) {
var aliases Aliases
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &aliases,
subject,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &account, nil
}
func (this accountTable) HasByControllerAddress(ctx context.Context, controller string, address string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
controller,
address,
)
}
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,
controller,
address,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &account, nil
}
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,
controller,
chain_code,
index,
)
}
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,
controller,
chain_code,
index,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &account, nil
}
func (this accountTable) List(ctx context.Context, prefixKey AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return AccountIterator{it}, err
}
func (this accountTable) ListRange(ctx context.Context, from, to AccountIndexKey, opts ...ormlist.Option) (AccountIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return AccountIterator{it}, err
}
func (this accountTable) DeleteBy(ctx context.Context, prefixKey AccountIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this accountTable) DeleteRange(ctx context.Context, from, to AccountIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this accountTable) doNotImplement() {}
var _ AccountTable = accountTable{}
func NewAccountTable(db ormtable.Schema) (AccountTable, error) {
table := db.GetTable(&Account{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Account{}).ProtoReflect().Descriptor().FullName()))
}
return accountTable{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 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
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) (*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
doNotImplement()
}
type ProofIterator struct {
ormtable.Iterator
}
func (i ProofIterator) Value() (*Proof, error) {
var proof Proof
err := i.UnmarshalMessage(&proof)
return &proof, err
}
type ProofIndexKey interface {
id() uint32
values() []interface{}
proofIndexKey()
}
// primary key starting index..
type ProofPrimaryKey = ProofIdIndexKey
type ProofIdIndexKey struct {
vs []interface{}
}
func (x ProofIdIndexKey) id() uint32 { return 0 }
func (x ProofIdIndexKey) values() []interface{} { return x.vs }
func (x ProofIdIndexKey) proofIndexKey() {}
func (this ProofIdIndexKey) WithId(id string) ProofIdIndexKey {
this.vs = []interface{}{id}
return this
}
type ProofControllerIssuerPropertyIndexKey struct {
vs []interface{}
}
func (x ProofControllerIssuerPropertyIndexKey) id() uint32 { return 1 }
func (x ProofControllerIssuerPropertyIndexKey) values() []interface{} { return x.vs }
func (x ProofControllerIssuerPropertyIndexKey) proofIndexKey() {}
func (this ProofControllerIssuerPropertyIndexKey) WithController(controller string) ProofControllerIssuerPropertyIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this ProofControllerIssuerPropertyIndexKey) WithControllerIssuer(controller string, issuer string) ProofControllerIssuerPropertyIndexKey {
this.vs = []interface{}{controller, issuer}
return this
}
func (this ProofControllerIssuerPropertyIndexKey) WithControllerIssuerProperty(controller string, issuer string, property string) ProofControllerIssuerPropertyIndexKey {
this.vs = []interface{}{controller, issuer, property}
return this
}
type proofTable struct {
table ormtable.Table
}
func (this proofTable) Insert(ctx context.Context, proof *Proof) error {
return this.table.Insert(ctx, proof)
}
func (this proofTable) Update(ctx context.Context, proof *Proof) error {
return this.table.Update(ctx, proof)
}
func (this proofTable) Save(ctx context.Context, proof *Proof) error {
return this.table.Save(ctx, proof)
}
func (this proofTable) Delete(ctx context.Context, proof *Proof) error {
return this.table.Delete(ctx, proof)
}
func (this proofTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this proofTable) Get(ctx context.Context, id string) (*Proof, error) {
var proof Proof
found, err := this.table.PrimaryKey().Get(ctx, &proof, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &proof, nil
}
func (this proofTable) HasByControllerIssuerProperty(ctx context.Context, controller string, issuer string, property string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
controller,
issuer,
property,
)
}
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,
controller,
issuer,
property,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &proof, nil
}
func (this proofTable) List(ctx context.Context, prefixKey ProofIndexKey, opts ...ormlist.Option) (ProofIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ProofIterator{it}, err
}
func (this proofTable) ListRange(ctx context.Context, from, to ProofIndexKey, opts ...ormlist.Option) (ProofIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ProofIterator{it}, err
}
func (this proofTable) DeleteBy(ctx context.Context, prefixKey ProofIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this proofTable) DeleteRange(ctx context.Context, from, to ProofIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this proofTable) doNotImplement() {}
var _ ProofTable = proofTable{}
func NewProofTable(db ormtable.Schema) (ProofTable, error) {
table := db.GetTable(&Proof{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Proof{}).ProtoReflect().Descriptor().FullName()))
}
return proofTable{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)
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)
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 ServiceRecordOriginIndexKey struct {
vs []interface{}
}
func (x ServiceRecordOriginIndexKey) id() uint32 { return 1 }
func (x ServiceRecordOriginIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordOriginIndexKey) serviceRecordIndexKey() {}
func (this ServiceRecordOriginIndexKey) WithOrigin(origin string) ServiceRecordOriginIndexKey {
this.vs = []interface{}{origin}
return this
}
type ServiceRecordAuthorityOriginIndexKey struct {
vs []interface{}
}
func (x ServiceRecordAuthorityOriginIndexKey) id() uint32 { return 2 }
func (x ServiceRecordAuthorityOriginIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordAuthorityOriginIndexKey) serviceRecordIndexKey() {}
func (this ServiceRecordAuthorityOriginIndexKey) WithAuthority(authority string) ServiceRecordAuthorityOriginIndexKey {
this.vs = []interface{}{authority}
return this
}
func (this ServiceRecordAuthorityOriginIndexKey) WithAuthorityOrigin(authority string, origin string) ServiceRecordAuthorityOriginIndexKey {
this.vs = []interface{}{authority, origin}
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) HasByOrigin(ctx context.Context, origin string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
origin,
)
}
func (this serviceRecordTable) GetByOrigin(ctx context.Context, origin string) (*ServiceRecord, error) {
var serviceRecord ServiceRecord
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &serviceRecord,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &serviceRecord, nil
}
func (this serviceRecordTable) HasByAuthorityOrigin(ctx context.Context, authority string, origin string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
authority,
origin,
)
}
func (this serviceRecordTable) GetByAuthorityOrigin(ctx context.Context, authority string, origin string) (*ServiceRecord, error) {
var serviceRecord ServiceRecord
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &serviceRecord,
authority,
origin,
)
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 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
}
type StateStore interface {
AccountTable() AccountTable
ControllerTable() ControllerTable
ProofTable() ProofTable
ServiceRecordTable() ServiceRecordTable
VerificationMethodTable() VerificationMethodTable
doNotImplement()
}
type stateStore struct {
account AccountTable
controller ControllerTable
proof ProofTable
serviceRecord ServiceRecordTable
verificationMethod VerificationMethodTable
}
func (x stateStore) AccountTable() AccountTable {
return x.account
}
func (x stateStore) ControllerTable() ControllerTable {
return x.controller
}
func (x stateStore) ProofTable() ProofTable {
return x.proof
}
func (x stateStore) ServiceRecordTable() ServiceRecordTable {
return x.serviceRecord
}
func (x stateStore) VerificationMethodTable() VerificationMethodTable {
return x.verificationMethod
}
func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) {
accountTable, err := NewAccountTable(db)
if err != nil {
return nil, err
}
controllerTable, err := NewControllerTable(db)
if err != nil {
return nil, err
}
proofTable, err := NewProofTable(db)
if err != nil {
return nil, err
}
serviceRecordTable, err := NewServiceRecordTable(db)
if err != nil {
return nil, err
}
verificationMethodTable, err := NewVerificationMethodTable(db)
if err != nil {
return nil, err
}
return stateStore{
accountTable,
controllerTable,
proofTable,
serviceRecordTable,
verificationMethodTable,
}, nil
}