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

591 lines
19 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-18 17:27:30 -04:00
type AliasTable interface {
Insert(ctx context.Context, alias *Alias) error
Update(ctx context.Context, alias *Alias) error
Save(ctx context.Context, alias *Alias) error
Delete(ctx context.Context, alias *Alias) 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-18 17:27:30 -04:00
Get(ctx context.Context, id string) (*Alias, error)
HasByDidAlias(ctx context.Context, did string, alias string) (found bool, err error)
// GetByDidAlias returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByDidAlias(ctx context.Context, did string, alias string) (*Alias, error)
List(ctx context.Context, prefixKey AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error)
ListRange(ctx context.Context, from, to AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error)
DeleteBy(ctx context.Context, prefixKey AliasIndexKey) error
DeleteRange(ctx context.Context, from, to AliasIndexKey) error
2024-07-06 03:02:45 -04:00
doNotImplement()
}
2024-09-18 17:27:30 -04:00
type AliasIterator struct {
2024-07-06 03:02:45 -04:00
ormtable.Iterator
}
2024-09-18 17:27:30 -04:00
func (i AliasIterator) Value() (*Alias, error) {
var alias Alias
err := i.UnmarshalMessage(&alias)
return &alias, err
2024-07-06 03:02:45 -04:00
}
2024-09-18 17:27:30 -04:00
type AliasIndexKey interface {
2024-07-06 03:02:45 -04:00
id() uint32
values() []interface{}
2024-09-18 17:27:30 -04:00
aliasIndexKey()
2024-07-06 03:02:45 -04:00
}
// primary key starting index..
2024-09-18 17:27:30 -04:00
type AliasPrimaryKey = AliasIdIndexKey
2024-07-06 03:02:45 -04:00
2024-09-18 17:27:30 -04:00
type AliasIdIndexKey struct {
2024-07-06 03:02:45 -04:00
vs []interface{}
}
2024-09-18 17:27:30 -04:00
func (x AliasIdIndexKey) id() uint32 { return 0 }
func (x AliasIdIndexKey) values() []interface{} { return x.vs }
func (x AliasIdIndexKey) aliasIndexKey() {}
2024-07-06 03:02:45 -04:00
2024-09-18 17:27:30 -04:00
func (this AliasIdIndexKey) WithId(id string) AliasIdIndexKey {
2024-07-06 03:02:45 -04:00
this.vs = []interface{}{id}
return this
}
2024-09-18 17:27:30 -04:00
type AliasDidAliasIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-18 17:27:30 -04:00
func (x AliasDidAliasIndexKey) id() uint32 { return 1 }
func (x AliasDidAliasIndexKey) values() []interface{} { return x.vs }
func (x AliasDidAliasIndexKey) aliasIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-18 17:27:30 -04:00
func (this AliasDidAliasIndexKey) WithDid(did string) AliasDidAliasIndexKey {
this.vs = []interface{}{did}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-18 17:27:30 -04:00
func (this AliasDidAliasIndexKey) WithDidAlias(did string, alias string) AliasDidAliasIndexKey {
this.vs = []interface{}{did, alias}
2024-09-05 01:24:57 -04:00
return this
}
2024-09-18 17:27:30 -04:00
type aliasTable struct {
2024-07-06 03:02:45 -04:00
table ormtable.Table
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) Insert(ctx context.Context, alias *Alias) error {
return this.table.Insert(ctx, alias)
2024-07-06 03:02:45 -04:00
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) Update(ctx context.Context, alias *Alias) error {
return this.table.Update(ctx, alias)
2024-07-06 03:02:45 -04:00
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) Save(ctx context.Context, alias *Alias) error {
return this.table.Save(ctx, alias)
2024-07-06 03:02:45 -04:00
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) Delete(ctx context.Context, alias *Alias) error {
return this.table.Delete(ctx, alias)
2024-07-06 03:02:45 -04:00
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) 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-18 17:27:30 -04:00
func (this aliasTable) Get(ctx context.Context, id string) (*Alias, error) {
var alias Alias
found, err := this.table.PrimaryKey().Get(ctx, &alias, id)
2024-07-06 03:02:45 -04:00
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-18 17:27:30 -04:00
return &alias, nil
2024-07-06 03:02:45 -04:00
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) HasByDidAlias(ctx context.Context, did string, alias string) (found bool, err error) {
2024-09-05 01:24:57 -04:00
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
2024-09-18 17:27:30 -04:00
did,
alias,
2024-09-05 01:24:57 -04:00
)
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) GetByDidAlias(ctx context.Context, did string, alias string) (*Alias, error) {
var alias Alias
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &alias,
did,
alias,
2024-09-05 01:24:57 -04:00
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-18 17:27:30 -04:00
return &alias, nil
2024-09-05 01:24:57 -04:00
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) List(ctx context.Context, prefixKey AliasIndexKey, opts ...ormlist.Option) (AliasIterator, error) {
2024-07-05 22:20:13 -04:00
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
2024-09-18 17:27:30 -04:00
return AliasIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) ListRange(ctx context.Context, from, to AliasIndexKey, opts ...ormlist.Option) (AliasIterator, 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-18 17:27:30 -04:00
return AliasIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) DeleteBy(ctx context.Context, prefixKey AliasIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) DeleteRange(ctx context.Context, from, to AliasIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
2024-09-18 17:27:30 -04:00
func (this aliasTable) doNotImplement() {}
2024-07-05 22:20:13 -04:00
2024-09-18 17:27:30 -04:00
var _ AliasTable = aliasTable{}
2024-07-05 22:20:13 -04:00
2024-09-18 17:27:30 -04:00
func NewAliasTable(db ormtable.Schema) (AliasTable, error) {
table := db.GetTable(&Alias{})
2024-07-05 22:20:13 -04:00
if table == nil {
2024-09-18 17:27:30 -04:00
return nil, ormerrors.TableNotFound.Wrap(string((&Alias{}).ProtoReflect().Descriptor().FullName()))
2024-07-05 22:20:13 -04:00
}
2024-09-18 17:27:30 -04:00
return aliasTable{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-09-18 17:27:30 -04:00
type ControllerStatusIndexKey struct {
vs []interface{}
}
func (x ControllerStatusIndexKey) id() uint32 { return 3 }
func (x ControllerStatusIndexKey) values() []interface{} { return x.vs }
func (x ControllerStatusIndexKey) controllerIndexKey() {}
func (this ControllerStatusIndexKey) WithStatus(status string) ControllerStatusIndexKey {
this.vs = []interface{}{status}
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-18 17:27:30 -04:00
type VerificationTable interface {
Insert(ctx context.Context, verification *Verification) error
Update(ctx context.Context, verification *Verification) error
Save(ctx context.Context, verification *Verification) error
Delete(ctx context.Context, verification *Verification) 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-18 17:27:30 -04:00
Get(ctx context.Context, id string) (*Verification, error)
2024-09-11 15:10:54 -04:00
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.
2024-09-18 17:27:30 -04:00
GetByControllerMethodIssuerSubject(ctx context.Context, controller string, method DIDNamespace, issuer string, subject string) (*Verification, error)
List(ctx context.Context, prefixKey VerificationIndexKey, opts ...ormlist.Option) (VerificationIterator, error)
ListRange(ctx context.Context, from, to VerificationIndexKey, opts ...ormlist.Option) (VerificationIterator, error)
DeleteBy(ctx context.Context, prefixKey VerificationIndexKey) error
DeleteRange(ctx context.Context, from, to VerificationIndexKey) error
2024-09-11 15:10:54 -04:00
doNotImplement()
}
2024-09-18 17:27:30 -04:00
type VerificationIterator struct {
2024-09-11 15:10:54 -04:00
ormtable.Iterator
}
2024-09-18 17:27:30 -04:00
func (i VerificationIterator) Value() (*Verification, error) {
var verification Verification
err := i.UnmarshalMessage(&verification)
return &verification, err
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
type VerificationIndexKey interface {
2024-09-11 15:10:54 -04:00
id() uint32
values() []interface{}
2024-09-18 17:27:30 -04:00
verificationIndexKey()
2024-09-11 15:10:54 -04:00
}
// primary key starting index..
2024-09-18 17:27:30 -04:00
type VerificationPrimaryKey = VerificationIdIndexKey
2024-09-11 15:10:54 -04:00
2024-09-18 17:27:30 -04:00
type VerificationIdIndexKey struct {
2024-09-11 15:10:54 -04:00
vs []interface{}
}
2024-09-18 17:27:30 -04:00
func (x VerificationIdIndexKey) id() uint32 { return 0 }
func (x VerificationIdIndexKey) values() []interface{} { return x.vs }
func (x VerificationIdIndexKey) verificationIndexKey() {}
2024-09-11 15:10:54 -04:00
2024-09-18 17:27:30 -04:00
func (this VerificationIdIndexKey) WithId(id string) VerificationIdIndexKey {
2024-09-11 15:10:54 -04:00
this.vs = []interface{}{id}
return this
}
2024-09-18 17:27:30 -04:00
type VerificationControllerMethodIssuerSubjectIndexKey struct {
2024-09-11 15:10:54 -04:00
vs []interface{}
}
2024-09-18 17:27:30 -04:00
func (x VerificationControllerMethodIssuerSubjectIndexKey) id() uint32 { return 1 }
func (x VerificationControllerMethodIssuerSubjectIndexKey) values() []interface{} { return x.vs }
func (x VerificationControllerMethodIssuerSubjectIndexKey) verificationIndexKey() {}
2024-09-11 15:10:54 -04:00
2024-09-18 17:27:30 -04:00
func (this VerificationControllerMethodIssuerSubjectIndexKey) WithController(controller string) VerificationControllerMethodIssuerSubjectIndexKey {
2024-09-11 15:10:54 -04:00
this.vs = []interface{}{controller}
return this
}
2024-09-18 17:27:30 -04:00
func (this VerificationControllerMethodIssuerSubjectIndexKey) WithControllerMethod(controller string, method DIDNamespace) VerificationControllerMethodIssuerSubjectIndexKey {
2024-09-11 15:10:54 -04:00
this.vs = []interface{}{controller, method}
return this
}
2024-09-18 17:27:30 -04:00
func (this VerificationControllerMethodIssuerSubjectIndexKey) WithControllerMethodIssuer(controller string, method DIDNamespace, issuer string) VerificationControllerMethodIssuerSubjectIndexKey {
2024-09-11 15:10:54 -04:00
this.vs = []interface{}{controller, method, issuer}
return this
}
2024-09-18 17:27:30 -04:00
func (this VerificationControllerMethodIssuerSubjectIndexKey) WithControllerMethodIssuerSubject(controller string, method DIDNamespace, issuer string, subject string) VerificationControllerMethodIssuerSubjectIndexKey {
2024-09-11 15:10:54 -04:00
this.vs = []interface{}{controller, method, issuer, subject}
return this
}
2024-09-18 17:27:30 -04:00
type verificationTable struct {
2024-09-11 15:10:54 -04:00
table ormtable.Table
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) Insert(ctx context.Context, verification *Verification) error {
return this.table.Insert(ctx, verification)
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) Update(ctx context.Context, verification *Verification) error {
return this.table.Update(ctx, verification)
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) Save(ctx context.Context, verification *Verification) error {
return this.table.Save(ctx, verification)
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) Delete(ctx context.Context, verification *Verification) error {
return this.table.Delete(ctx, verification)
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) Has(ctx context.Context, id string) (found bool, err error) {
2024-09-11 15:10:54 -04:00
return this.table.PrimaryKey().Has(ctx, id)
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) Get(ctx context.Context, id string) (*Verification, error) {
var verification Verification
found, err := this.table.PrimaryKey().Get(ctx, &verification, id)
2024-09-11 15:10:54 -04:00
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-18 17:27:30 -04:00
return &verification, nil
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) HasByControllerMethodIssuerSubject(ctx context.Context, controller string, method DIDNamespace, issuer string, subject string) (found bool, err error) {
2024-09-11 15:10:54 -04:00
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
controller,
method,
issuer,
subject,
)
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) GetByControllerMethodIssuerSubject(ctx context.Context, controller string, method DIDNamespace, issuer string, subject string) (*Verification, error) {
var verification Verification
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &verification,
2024-09-11 15:10:54 -04:00
controller,
method,
issuer,
subject,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-18 17:27:30 -04:00
return &verification, nil
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) List(ctx context.Context, prefixKey VerificationIndexKey, opts ...ormlist.Option) (VerificationIterator, error) {
2024-09-11 15:10:54 -04:00
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
2024-09-18 17:27:30 -04:00
return VerificationIterator{it}, err
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) ListRange(ctx context.Context, from, to VerificationIndexKey, opts ...ormlist.Option) (VerificationIterator, error) {
2024-09-11 15:10:54 -04:00
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
2024-09-18 17:27:30 -04:00
return VerificationIterator{it}, err
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) DeleteBy(ctx context.Context, prefixKey VerificationIndexKey) error {
2024-09-11 15:10:54 -04:00
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) DeleteRange(ctx context.Context, from, to VerificationIndexKey) error {
2024-09-11 15:10:54 -04:00
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
2024-09-18 17:27:30 -04:00
func (this verificationTable) doNotImplement() {}
2024-09-11 15:10:54 -04:00
2024-09-18 17:27:30 -04:00
var _ VerificationTable = verificationTable{}
2024-09-11 15:10:54 -04:00
2024-09-18 17:27:30 -04:00
func NewVerificationTable(db ormtable.Schema) (VerificationTable, error) {
table := db.GetTable(&Verification{})
2024-09-11 15:10:54 -04:00
if table == nil {
2024-09-18 17:27:30 -04:00
return nil, ormerrors.TableNotFound.Wrap(string((&Verification{}).ProtoReflect().Descriptor().FullName()))
2024-09-11 15:10:54 -04:00
}
2024-09-18 17:27:30 -04:00
return verificationTable{table}, nil
2024-09-11 15:10:54 -04:00
}
2024-07-05 22:20:13 -04:00
type StateStore interface {
2024-09-18 17:27:30 -04:00
AliasTable() AliasTable
2024-07-05 22:20:13 -04:00
ControllerTable() ControllerTable
2024-09-18 17:27:30 -04:00
VerificationTable() VerificationTable
2024-07-05 22:20:13 -04:00
doNotImplement()
}
type stateStore struct {
2024-09-18 17:27:30 -04:00
alias AliasTable
controller ControllerTable
verification VerificationTable
2024-07-05 22:20:13 -04:00
}
2024-09-18 17:27:30 -04:00
func (x stateStore) AliasTable() AliasTable {
return x.alias
2024-07-05 22:20:13 -04:00
}
func (x stateStore) ControllerTable() ControllerTable {
return x.controller
}
2024-09-18 17:27:30 -04:00
func (x stateStore) VerificationTable() VerificationTable {
return x.verification
2024-09-11 15:10:54 -04:00
}
2024-07-05 22:20:13 -04:00
func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) {
2024-09-18 17:27:30 -04:00
aliasTable, err := NewAliasTable(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-18 17:27:30 -04:00
verificationTable, err := NewVerificationTable(db)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
return stateStore{
2024-09-18 17:27:30 -04:00
aliasTable,
2024-07-05 22:20:13 -04:00
controllerTable,
2024-09-18 17:27:30 -04:00
verificationTable,
2024-07-05 22:20:13 -04:00
}, nil
}