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

1128 lines
39 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-07 18:12:58 -04:00
type AuthenticationTable interface {
Insert(ctx context.Context, authentication *Authentication) error
Update(ctx context.Context, authentication *Authentication) error
Save(ctx context.Context, authentication *Authentication) error
Delete(ctx context.Context, authentication *Authentication) 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-07 18:12:58 -04:00
Get(ctx context.Context, id string) (*Authentication, error)
2024-09-05 01:24:57 -04:00
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
2024-09-07 18:12:58 -04:00
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Authentication, error)
2024-09-05 01:24:57 -04:00
HasByControllerOrigin(ctx context.Context, controller string, origin string) (found bool, err error)
// GetByControllerOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
2024-09-07 18:12:58 -04:00
GetByControllerOrigin(ctx context.Context, controller string, origin string) (*Authentication, error)
2024-09-05 01:24:57 -04:00
HasByControllerCredentialLabel(ctx context.Context, controller string, credential_label string) (found bool, err error)
// GetByControllerCredentialLabel returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
2024-09-07 18:12:58 -04:00
GetByControllerCredentialLabel(ctx context.Context, controller string, credential_label string) (*Authentication, error)
List(ctx context.Context, prefixKey AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error)
ListRange(ctx context.Context, from, to AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error)
DeleteBy(ctx context.Context, prefixKey AuthenticationIndexKey) error
DeleteRange(ctx context.Context, from, to AuthenticationIndexKey) error
2024-07-06 03:02:45 -04:00
doNotImplement()
}
2024-09-07 18:12:58 -04:00
type AuthenticationIterator struct {
2024-07-06 03:02:45 -04:00
ormtable.Iterator
}
2024-09-07 18:12:58 -04:00
func (i AuthenticationIterator) Value() (*Authentication, error) {
var authentication Authentication
err := i.UnmarshalMessage(&authentication)
return &authentication, err
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
type AuthenticationIndexKey interface {
2024-07-06 03:02:45 -04:00
id() uint32
values() []interface{}
2024-09-07 18:12:58 -04:00
authenticationIndexKey()
2024-07-06 03:02:45 -04:00
}
// primary key starting index..
2024-09-07 18:12:58 -04:00
type AuthenticationPrimaryKey = AuthenticationIdIndexKey
2024-07-06 03:02:45 -04:00
2024-09-07 18:12:58 -04:00
type AuthenticationIdIndexKey struct {
2024-07-06 03:02:45 -04:00
vs []interface{}
}
2024-09-07 18:12:58 -04:00
func (x AuthenticationIdIndexKey) id() uint32 { return 0 }
func (x AuthenticationIdIndexKey) values() []interface{} { return x.vs }
func (x AuthenticationIdIndexKey) authenticationIndexKey() {}
2024-07-06 03:02:45 -04:00
2024-09-07 18:12:58 -04:00
func (this AuthenticationIdIndexKey) WithId(id string) AuthenticationIdIndexKey {
2024-07-06 03:02:45 -04:00
this.vs = []interface{}{id}
return this
}
2024-09-07 18:12:58 -04:00
type AuthenticationSubjectOriginIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-07 18:12:58 -04:00
func (x AuthenticationSubjectOriginIndexKey) id() uint32 { return 1 }
func (x AuthenticationSubjectOriginIndexKey) values() []interface{} { return x.vs }
func (x AuthenticationSubjectOriginIndexKey) authenticationIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-07 18:12:58 -04:00
func (this AuthenticationSubjectOriginIndexKey) WithSubject(subject string) AuthenticationSubjectOriginIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{subject}
return this
}
2024-09-07 18:12:58 -04:00
func (this AuthenticationSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) AuthenticationSubjectOriginIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{subject, origin}
return this
}
2024-09-07 18:12:58 -04:00
type AuthenticationControllerOriginIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-07 18:12:58 -04:00
func (x AuthenticationControllerOriginIndexKey) id() uint32 { return 2 }
func (x AuthenticationControllerOriginIndexKey) values() []interface{} { return x.vs }
func (x AuthenticationControllerOriginIndexKey) authenticationIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-07 18:12:58 -04:00
func (this AuthenticationControllerOriginIndexKey) WithController(controller string) AuthenticationControllerOriginIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{controller}
return this
}
2024-09-07 18:12:58 -04:00
func (this AuthenticationControllerOriginIndexKey) WithControllerOrigin(controller string, origin string) AuthenticationControllerOriginIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{controller, origin}
return this
}
2024-09-07 18:12:58 -04:00
type AuthenticationControllerCredentialLabelIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-07 18:12:58 -04:00
func (x AuthenticationControllerCredentialLabelIndexKey) id() uint32 { return 3 }
func (x AuthenticationControllerCredentialLabelIndexKey) values() []interface{} { return x.vs }
func (x AuthenticationControllerCredentialLabelIndexKey) authenticationIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-07 18:12:58 -04:00
func (this AuthenticationControllerCredentialLabelIndexKey) WithController(controller string) AuthenticationControllerCredentialLabelIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{controller}
return this
}
2024-09-07 18:12:58 -04:00
func (this AuthenticationControllerCredentialLabelIndexKey) WithControllerCredentialLabel(controller string, credential_label string) AuthenticationControllerCredentialLabelIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{controller, credential_label}
return this
}
2024-09-07 18:12:58 -04:00
type authenticationTable struct {
2024-07-06 03:02:45 -04:00
table ormtable.Table
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) Insert(ctx context.Context, authentication *Authentication) error {
return this.table.Insert(ctx, authentication)
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) Update(ctx context.Context, authentication *Authentication) error {
return this.table.Update(ctx, authentication)
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) Save(ctx context.Context, authentication *Authentication) error {
return this.table.Save(ctx, authentication)
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) Delete(ctx context.Context, authentication *Authentication) error {
return this.table.Delete(ctx, authentication)
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) 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-07 18:12:58 -04:00
func (this authenticationTable) Get(ctx context.Context, id string) (*Authentication, error) {
var authentication Authentication
found, err := this.table.PrimaryKey().Get(ctx, &authentication, id)
2024-07-06 03:02:45 -04:00
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-07 18:12:58 -04:00
return &authentication, nil
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
2024-09-05 01:24:57 -04:00
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
subject,
origin,
)
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Authentication, error) {
var authentication Authentication
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &authentication,
2024-09-05 01:24:57 -04:00
subject,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-07 18:12:58 -04:00
return &authentication, nil
2024-09-05 01:24:57 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) HasByControllerOrigin(ctx context.Context, controller string, origin string) (found bool, err error) {
2024-09-05 01:24:57 -04:00
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
controller,
origin,
)
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) GetByControllerOrigin(ctx context.Context, controller string, origin string) (*Authentication, error) {
var authentication Authentication
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &authentication,
2024-09-05 01:24:57 -04:00
controller,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-07 18:12:58 -04:00
return &authentication, nil
2024-09-05 01:24:57 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) HasByControllerCredentialLabel(ctx context.Context, controller string, credential_label string) (found bool, err error) {
2024-09-05 01:24:57 -04:00
return this.table.GetIndexByID(3).(ormtable.UniqueIndex).Has(ctx,
controller,
credential_label,
)
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) GetByControllerCredentialLabel(ctx context.Context, controller string, credential_label string) (*Authentication, error) {
var authentication Authentication
found, err := this.table.GetIndexByID(3).(ormtable.UniqueIndex).Get(ctx, &authentication,
2024-09-05 01:24:57 -04:00
controller,
credential_label,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-07 18:12:58 -04:00
return &authentication, nil
2024-09-05 01:24:57 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) List(ctx context.Context, prefixKey AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error) {
2024-07-06 03:02:45 -04:00
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
2024-09-07 18:12:58 -04:00
return AuthenticationIterator{it}, err
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) ListRange(ctx context.Context, from, to AuthenticationIndexKey, opts ...ormlist.Option) (AuthenticationIterator, error) {
2024-07-06 03:02:45 -04:00
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
2024-09-07 18:12:58 -04:00
return AuthenticationIterator{it}, err
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) DeleteBy(ctx context.Context, prefixKey AuthenticationIndexKey) error {
2024-07-06 03:02:45 -04:00
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) DeleteRange(ctx context.Context, from, to AuthenticationIndexKey) error {
2024-07-06 03:02:45 -04:00
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
2024-09-07 18:12:58 -04:00
func (this authenticationTable) doNotImplement() {}
2024-07-06 03:02:45 -04:00
2024-09-07 18:12:58 -04:00
var _ AuthenticationTable = authenticationTable{}
2024-07-06 03:02:45 -04:00
2024-09-07 18:12:58 -04:00
func NewAuthenticationTable(db ormtable.Schema) (AuthenticationTable, error) {
table := db.GetTable(&Authentication{})
2024-07-06 03:02:45 -04:00
if table == nil {
2024-09-07 18:12:58 -04:00
return nil, ormerrors.TableNotFound.Wrap(string((&Authentication{}).ProtoReflect().Descriptor().FullName()))
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
return authenticationTable{table}, nil
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
type AssertionTable interface {
Insert(ctx context.Context, assertion *Assertion) error
Update(ctx context.Context, assertion *Assertion) error
Save(ctx context.Context, assertion *Assertion) error
Delete(ctx context.Context, assertion *Assertion) error
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-07 18:12:58 -04:00
Get(ctx context.Context, id string) (*Assertion, error)
2024-08-31 16:54:16 -04:00
HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error)
// GetBySubjectOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
2024-09-07 18:12:58 -04:00
GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Assertion, error)
2024-09-05 01:24:57 -04:00
HasByControllerOrigin(ctx context.Context, controller string, origin string) (found bool, err error)
// GetByControllerOrigin returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
2024-09-07 18:12:58 -04:00
GetByControllerOrigin(ctx context.Context, controller string, origin string) (*Assertion, error)
List(ctx context.Context, prefixKey AssertionIndexKey, opts ...ormlist.Option) (AssertionIterator, error)
ListRange(ctx context.Context, from, to AssertionIndexKey, opts ...ormlist.Option) (AssertionIterator, error)
DeleteBy(ctx context.Context, prefixKey AssertionIndexKey) error
DeleteRange(ctx context.Context, from, to AssertionIndexKey) error
2024-07-05 22:20:13 -04:00
doNotImplement()
}
2024-09-07 18:12:58 -04:00
type AssertionIterator struct {
2024-07-05 22:20:13 -04:00
ormtable.Iterator
}
2024-09-07 18:12:58 -04:00
func (i AssertionIterator) Value() (*Assertion, error) {
var assertion Assertion
err := i.UnmarshalMessage(&assertion)
return &assertion, err
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
type AssertionIndexKey interface {
2024-07-05 22:20:13 -04:00
id() uint32
values() []interface{}
2024-09-07 18:12:58 -04:00
assertionIndexKey()
2024-07-05 22:20:13 -04:00
}
// primary key starting index..
2024-09-07 18:12:58 -04:00
type AssertionPrimaryKey = AssertionIdIndexKey
2024-07-05 22:20:13 -04:00
2024-09-07 18:12:58 -04:00
type AssertionIdIndexKey struct {
2024-07-05 22:20:13 -04:00
vs []interface{}
}
2024-09-07 18:12:58 -04:00
func (x AssertionIdIndexKey) id() uint32 { return 0 }
func (x AssertionIdIndexKey) values() []interface{} { return x.vs }
func (x AssertionIdIndexKey) assertionIndexKey() {}
2024-07-05 22:20:13 -04:00
2024-09-07 18:12:58 -04:00
func (this AssertionIdIndexKey) WithId(id string) AssertionIdIndexKey {
2024-07-05 22:20:13 -04:00
this.vs = []interface{}{id}
return this
}
2024-09-07 18:12:58 -04:00
type AssertionSubjectOriginIndexKey struct {
2024-08-31 16:54:16 -04:00
vs []interface{}
}
2024-09-07 18:12:58 -04:00
func (x AssertionSubjectOriginIndexKey) id() uint32 { return 1 }
func (x AssertionSubjectOriginIndexKey) values() []interface{} { return x.vs }
func (x AssertionSubjectOriginIndexKey) assertionIndexKey() {}
2024-08-31 16:54:16 -04:00
2024-09-07 18:12:58 -04:00
func (this AssertionSubjectOriginIndexKey) WithSubject(subject string) AssertionSubjectOriginIndexKey {
2024-08-31 16:54:16 -04:00
this.vs = []interface{}{subject}
return this
}
2024-09-07 18:12:58 -04:00
func (this AssertionSubjectOriginIndexKey) WithSubjectOrigin(subject string, origin string) AssertionSubjectOriginIndexKey {
2024-08-31 16:54:16 -04:00
this.vs = []interface{}{subject, origin}
return this
}
2024-09-07 18:12:58 -04:00
type AssertionControllerOriginIndexKey struct {
2024-09-05 01:24:57 -04:00
vs []interface{}
}
2024-09-07 18:12:58 -04:00
func (x AssertionControllerOriginIndexKey) id() uint32 { return 2 }
func (x AssertionControllerOriginIndexKey) values() []interface{} { return x.vs }
func (x AssertionControllerOriginIndexKey) assertionIndexKey() {}
2024-09-05 01:24:57 -04:00
2024-09-07 18:12:58 -04:00
func (this AssertionControllerOriginIndexKey) WithController(controller string) AssertionControllerOriginIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{controller}
return this
}
2024-09-07 18:12:58 -04:00
func (this AssertionControllerOriginIndexKey) WithControllerOrigin(controller string, origin string) AssertionControllerOriginIndexKey {
2024-09-05 01:24:57 -04:00
this.vs = []interface{}{controller, origin}
return this
}
2024-09-07 18:12:58 -04:00
type assertionTable struct {
2024-07-05 22:20:13 -04:00
table ormtable.Table
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) Insert(ctx context.Context, assertion *Assertion) error {
return this.table.Insert(ctx, assertion)
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) Update(ctx context.Context, assertion *Assertion) error {
return this.table.Update(ctx, assertion)
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) Save(ctx context.Context, assertion *Assertion) error {
return this.table.Save(ctx, assertion)
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) Delete(ctx context.Context, assertion *Assertion) error {
return this.table.Delete(ctx, assertion)
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) 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-07 18:12:58 -04:00
func (this assertionTable) Get(ctx context.Context, id string) (*Assertion, error) {
var assertion Assertion
found, err := this.table.PrimaryKey().Get(ctx, &assertion, id)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-07 18:12:58 -04:00
return &assertion, nil
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) HasBySubjectOrigin(ctx context.Context, subject string, origin string) (found bool, err error) {
2024-08-31 16:54:16 -04:00
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
subject,
origin,
)
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) GetBySubjectOrigin(ctx context.Context, subject string, origin string) (*Assertion, error) {
var assertion Assertion
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &assertion,
2024-08-31 16:54:16 -04:00
subject,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-07 18:12:58 -04:00
return &assertion, nil
2024-08-31 16:54:16 -04:00
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) HasByControllerOrigin(ctx context.Context, controller string, origin string) (found bool, err error) {
2024-09-05 01:24:57 -04:00
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
controller,
origin,
)
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) GetByControllerOrigin(ctx context.Context, controller string, origin string) (*Assertion, error) {
var assertion Assertion
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &assertion,
2024-09-05 01:24:57 -04:00
controller,
origin,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2024-09-07 18:12:58 -04:00
return &assertion, nil
2024-09-05 01:24:57 -04:00
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) List(ctx context.Context, prefixKey AssertionIndexKey, opts ...ormlist.Option) (AssertionIterator, error) {
2024-07-05 22:20:13 -04:00
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
2024-09-07 18:12:58 -04:00
return AssertionIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) ListRange(ctx context.Context, from, to AssertionIndexKey, opts ...ormlist.Option) (AssertionIterator, 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-07 18:12:58 -04:00
return AssertionIterator{it}, err
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) DeleteBy(ctx context.Context, prefixKey AssertionIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) DeleteRange(ctx context.Context, from, to AssertionIndexKey) error {
2024-07-05 22:20:13 -04:00
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
2024-09-07 18:12:58 -04:00
func (this assertionTable) doNotImplement() {}
2024-07-05 22:20:13 -04:00
2024-09-07 18:12:58 -04:00
var _ AssertionTable = assertionTable{}
2024-07-05 22:20:13 -04:00
2024-09-07 18:12:58 -04:00
func NewAssertionTable(db ormtable.Schema) (AssertionTable, error) {
table := db.GetTable(&Assertion{})
2024-07-05 22:20:13 -04:00
if table == nil {
2024-09-07 18:12:58 -04:00
return nil, ormerrors.TableNotFound.Wrap(string((&Assertion{}).ProtoReflect().Descriptor().FullName()))
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
return assertionTable{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
}
type DelegationTable interface {
Insert(ctx context.Context, delegation *Delegation) error
Update(ctx context.Context, delegation *Delegation) error
Save(ctx context.Context, delegation *Delegation) error
Delete(ctx context.Context, delegation *Delegation) error
Has(ctx context.Context, id string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
Get(ctx context.Context, id string) (*Delegation, error)
2024-09-05 01:24:57 -04:00
HasByAccountAddressChainId(ctx context.Context, account_address string, chain_id string) (found bool, err error)
// GetByAccountAddressChainId returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByAccountAddressChainId(ctx context.Context, account_address string, chain_id string) (*Delegation, error)
HasByControllerAccountLabel(ctx context.Context, controller string, account_label string) (found bool, err error)
// GetByControllerAccountLabel returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerAccountLabel(ctx context.Context, controller string, account_label string) (*Delegation, error)
2024-07-05 22:20:13 -04:00
List(ctx context.Context, prefixKey DelegationIndexKey, opts ...ormlist.Option) (DelegationIterator, error)
ListRange(ctx context.Context, from, to DelegationIndexKey, opts ...ormlist.Option) (DelegationIterator, error)
DeleteBy(ctx context.Context, prefixKey DelegationIndexKey) error
DeleteRange(ctx context.Context, from, to DelegationIndexKey) error
doNotImplement()
}
type DelegationIterator struct {
ormtable.Iterator
}
func (i DelegationIterator) Value() (*Delegation, error) {
var delegation Delegation
err := i.UnmarshalMessage(&delegation)
return &delegation, err
}
type DelegationIndexKey interface {
id() uint32
values() []interface{}
delegationIndexKey()
}
// primary key starting index..
type DelegationPrimaryKey = DelegationIdIndexKey
type DelegationIdIndexKey struct {
vs []interface{}
}
func (x DelegationIdIndexKey) id() uint32 { return 0 }
func (x DelegationIdIndexKey) values() []interface{} { return x.vs }
func (x DelegationIdIndexKey) delegationIndexKey() {}
func (this DelegationIdIndexKey) WithId(id string) DelegationIdIndexKey {
this.vs = []interface{}{id}
return this
}
2024-09-05 01:24:57 -04:00
type DelegationAccountAddressChainIdIndexKey struct {
vs []interface{}
}
func (x DelegationAccountAddressChainIdIndexKey) id() uint32 { return 1 }
func (x DelegationAccountAddressChainIdIndexKey) values() []interface{} { return x.vs }
func (x DelegationAccountAddressChainIdIndexKey) delegationIndexKey() {}
func (this DelegationAccountAddressChainIdIndexKey) WithAccountAddress(account_address string) DelegationAccountAddressChainIdIndexKey {
this.vs = []interface{}{account_address}
return this
}
func (this DelegationAccountAddressChainIdIndexKey) WithAccountAddressChainId(account_address string, chain_id string) DelegationAccountAddressChainIdIndexKey {
this.vs = []interface{}{account_address, chain_id}
return this
}
type DelegationControllerAccountLabelIndexKey struct {
vs []interface{}
}
func (x DelegationControllerAccountLabelIndexKey) id() uint32 { return 2 }
func (x DelegationControllerAccountLabelIndexKey) values() []interface{} { return x.vs }
func (x DelegationControllerAccountLabelIndexKey) delegationIndexKey() {}
func (this DelegationControllerAccountLabelIndexKey) WithController(controller string) DelegationControllerAccountLabelIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this DelegationControllerAccountLabelIndexKey) WithControllerAccountLabel(controller string, account_label string) DelegationControllerAccountLabelIndexKey {
this.vs = []interface{}{controller, account_label}
return this
}
type DelegationControllerChainIdIndexKey struct {
vs []interface{}
}
func (x DelegationControllerChainIdIndexKey) id() uint32 { return 3 }
func (x DelegationControllerChainIdIndexKey) values() []interface{} { return x.vs }
func (x DelegationControllerChainIdIndexKey) delegationIndexKey() {}
func (this DelegationControllerChainIdIndexKey) WithController(controller string) DelegationControllerChainIdIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this DelegationControllerChainIdIndexKey) WithControllerChainId(controller string, chain_id string) DelegationControllerChainIdIndexKey {
this.vs = []interface{}{controller, chain_id}
return this
}
2024-07-05 22:20:13 -04:00
type delegationTable struct {
table ormtable.Table
}
func (this delegationTable) Insert(ctx context.Context, delegation *Delegation) error {
return this.table.Insert(ctx, delegation)
}
func (this delegationTable) Update(ctx context.Context, delegation *Delegation) error {
return this.table.Update(ctx, delegation)
}
func (this delegationTable) Save(ctx context.Context, delegation *Delegation) error {
return this.table.Save(ctx, delegation)
}
func (this delegationTable) Delete(ctx context.Context, delegation *Delegation) error {
return this.table.Delete(ctx, delegation)
}
func (this delegationTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
func (this delegationTable) Get(ctx context.Context, id string) (*Delegation, error) {
var delegation Delegation
found, err := this.table.PrimaryKey().Get(ctx, &delegation, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &delegation, nil
}
2024-09-05 01:24:57 -04:00
func (this delegationTable) HasByAccountAddressChainId(ctx context.Context, account_address string, chain_id string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
account_address,
chain_id,
)
}
func (this delegationTable) GetByAccountAddressChainId(ctx context.Context, account_address string, chain_id string) (*Delegation, error) {
var delegation Delegation
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &delegation,
account_address,
chain_id,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &delegation, nil
}
func (this delegationTable) HasByControllerAccountLabel(ctx context.Context, controller string, account_label string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
controller,
account_label,
)
}
func (this delegationTable) GetByControllerAccountLabel(ctx context.Context, controller string, account_label string) (*Delegation, error) {
var delegation Delegation
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &delegation,
controller,
account_label,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &delegation, nil
}
2024-07-05 22:20:13 -04:00
func (this delegationTable) List(ctx context.Context, prefixKey DelegationIndexKey, opts ...ormlist.Option) (DelegationIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return DelegationIterator{it}, err
}
func (this delegationTable) ListRange(ctx context.Context, from, to DelegationIndexKey, opts ...ormlist.Option) (DelegationIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return DelegationIterator{it}, err
}
func (this delegationTable) DeleteBy(ctx context.Context, prefixKey DelegationIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this delegationTable) DeleteRange(ctx context.Context, from, to DelegationIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this delegationTable) doNotImplement() {}
var _ DelegationTable = delegationTable{}
func NewDelegationTable(db ormtable.Schema) (DelegationTable, error) {
table := db.GetTable(&Delegation{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&Delegation{}).ProtoReflect().Descriptor().FullName()))
}
return delegationTable{table}, nil
}
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)
HasByOriginUri(ctx context.Context, origin_uri string) (found bool, err error)
// GetByOriginUri returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByOriginUri(ctx context.Context, origin_uri string) (*ServiceRecord, error)
HasByControllerOriginUri(ctx context.Context, controller string, origin_uri string) (found bool, err error)
// GetByControllerOriginUri returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByControllerOriginUri(ctx context.Context, controller string, origin_uri string) (*ServiceRecord, error)
List(ctx context.Context, prefixKey ServiceRecordIndexKey, opts ...ormlist.Option) (ServiceRecordIterator, error)
ListRange(ctx context.Context, from, to ServiceRecordIndexKey, opts ...ormlist.Option) (ServiceRecordIterator, error)
DeleteBy(ctx context.Context, prefixKey ServiceRecordIndexKey) error
DeleteRange(ctx context.Context, from, to ServiceRecordIndexKey) error
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-05 01:24:57 -04:00
type ServiceRecordOriginUriIndexKey struct {
vs []interface{}
}
func (x ServiceRecordOriginUriIndexKey) id() uint32 { return 1 }
func (x ServiceRecordOriginUriIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordOriginUriIndexKey) serviceRecordIndexKey() {}
func (this ServiceRecordOriginUriIndexKey) WithOriginUri(origin_uri string) ServiceRecordOriginUriIndexKey {
this.vs = []interface{}{origin_uri}
return this
}
type ServiceRecordControllerOriginUriIndexKey struct {
vs []interface{}
}
func (x ServiceRecordControllerOriginUriIndexKey) id() uint32 { return 2 }
func (x ServiceRecordControllerOriginUriIndexKey) values() []interface{} { return x.vs }
func (x ServiceRecordControllerOriginUriIndexKey) serviceRecordIndexKey() {}
func (this ServiceRecordControllerOriginUriIndexKey) WithController(controller string) ServiceRecordControllerOriginUriIndexKey {
this.vs = []interface{}{controller}
return this
}
func (this ServiceRecordControllerOriginUriIndexKey) WithControllerOriginUri(controller string, origin_uri string) ServiceRecordControllerOriginUriIndexKey {
this.vs = []interface{}{controller, origin_uri}
return this
}
type serviceRecordTable struct {
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
}
func (this serviceRecordTable) HasByOriginUri(ctx context.Context, origin_uri string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
origin_uri,
)
}
func (this serviceRecordTable) GetByOriginUri(ctx context.Context, origin_uri string) (*ServiceRecord, error) {
var serviceRecord ServiceRecord
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &serviceRecord,
origin_uri,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &serviceRecord, nil
}
func (this serviceRecordTable) HasByControllerOriginUri(ctx context.Context, controller string, origin_uri string) (found bool, err error) {
return this.table.GetIndexByID(2).(ormtable.UniqueIndex).Has(ctx,
controller,
origin_uri,
)
}
func (this serviceRecordTable) GetByControllerOriginUri(ctx context.Context, controller string, origin_uri string) (*ServiceRecord, error) {
var serviceRecord ServiceRecord
found, err := this.table.GetIndexByID(2).(ormtable.UniqueIndex).Get(ctx, &serviceRecord,
controller,
origin_uri,
)
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
}
type StateStore interface {
2024-09-07 18:12:58 -04:00
AuthenticationTable() AuthenticationTable
2024-07-06 03:02:45 -04:00
AssertionTable() AssertionTable
2024-07-05 22:20:13 -04:00
ControllerTable() ControllerTable
DelegationTable() DelegationTable
2024-09-05 01:24:57 -04:00
ServiceRecordTable() ServiceRecordTable
2024-07-05 22:20:13 -04:00
doNotImplement()
}
type stateStore struct {
2024-09-07 18:12:58 -04:00
authentication AuthenticationTable
assertion AssertionTable
controller ControllerTable
delegation DelegationTable
serviceRecord ServiceRecordTable
2024-07-05 22:20:13 -04:00
}
2024-09-07 18:12:58 -04:00
func (x stateStore) AuthenticationTable() AuthenticationTable {
return x.authentication
2024-07-06 03:02:45 -04:00
}
2024-09-07 18:12:58 -04:00
func (x stateStore) AssertionTable() AssertionTable {
return x.assertion
2024-07-05 22:20:13 -04:00
}
func (x stateStore) ControllerTable() ControllerTable {
return x.controller
}
func (x stateStore) DelegationTable() DelegationTable {
return x.delegation
}
2024-09-05 01:24:57 -04:00
func (x stateStore) ServiceRecordTable() ServiceRecordTable {
return x.serviceRecord
2024-07-05 22:20:13 -04:00
}
func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) {
2024-09-07 18:12:58 -04:00
authenticationTable, err := NewAuthenticationTable(db)
2024-07-06 03:02:45 -04:00
if err != nil {
return nil, err
}
2024-09-07 18:12:58 -04:00
assertionTable, err := NewAssertionTable(db)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
controllerTable, err := NewControllerTable(db)
if err != nil {
return nil, err
}
delegationTable, err := NewDelegationTable(db)
if err != nil {
return nil, err
}
2024-09-05 01:24:57 -04:00
serviceRecordTable, err := NewServiceRecordTable(db)
2024-07-05 22:20:13 -04:00
if err != nil {
return nil, err
}
return stateStore{
2024-09-07 18:12:58 -04:00
authenticationTable,
2024-07-06 03:02:45 -04:00
assertionTable,
2024-07-05 22:20:13 -04:00
controllerTable,
delegationTable,
2024-09-05 01:24:57 -04:00
serviceRecordTable,
2024-07-05 22:20:13 -04:00
}, nil
}