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

974 lines
34 KiB
Go
Raw Normal View History

2024-09-26 18:01:49 -04:00
// Code generated by protoc-gen-go-cosmos-orm. DO NOT EDIT.
2024-11-26 22:05:50 -05:00
package svcv1
2024-09-26 18:01:49 -04:00
import (
context "context"
2025-10-03 14:45:52 -04:00
2024-09-26 18:01:49 -04:00
ormlist "cosmossdk.io/orm/model/ormlist"
ormtable "cosmossdk.io/orm/model/ormtable"
ormerrors "cosmossdk.io/orm/types/ormerrors"
)
2025-10-03 14:45:52 -04:00
type ServiceTable interface {
Insert(ctx context.Context, service *Service) error
Update(ctx context.Context, service *Service) error
Save(ctx context.Context, service *Service) error
Delete(ctx context.Context, service *Service) error
Has(ctx context.Context, id string) (found bool, err error)
2024-09-26 18:01:49 -04:00
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
2025-10-03 14:45:52 -04:00
Get(ctx context.Context, id string) (*Service, error)
HasByDomain(ctx context.Context, domain string) (found bool, err error)
// GetByDomain returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByDomain(ctx context.Context, domain string) (*Service, error)
List(ctx context.Context, prefixKey ServiceIndexKey, opts ...ormlist.Option) (ServiceIterator, error)
ListRange(ctx context.Context, from, to ServiceIndexKey, opts ...ormlist.Option) (ServiceIterator, error)
DeleteBy(ctx context.Context, prefixKey ServiceIndexKey) error
DeleteRange(ctx context.Context, from, to ServiceIndexKey) error
2024-09-26 18:01:49 -04:00
doNotImplement()
}
2025-10-03 14:45:52 -04:00
type ServiceIterator struct {
2024-09-26 18:01:49 -04:00
ormtable.Iterator
}
2025-10-03 14:45:52 -04:00
func (i ServiceIterator) Value() (*Service, error) {
var service Service
err := i.UnmarshalMessage(&service)
return &service, err
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
type ServiceIndexKey interface {
2024-09-26 18:01:49 -04:00
id() uint32
values() []interface{}
2025-10-03 14:45:52 -04:00
serviceIndexKey()
2024-09-26 18:01:49 -04:00
}
// primary key starting index..
2025-10-03 14:45:52 -04:00
type ServicePrimaryKey = ServiceIdIndexKey
2024-09-26 18:01:49 -04:00
2025-10-03 14:45:52 -04:00
type ServiceIdIndexKey struct {
2024-09-26 18:01:49 -04:00
vs []interface{}
}
2025-10-03 14:45:52 -04:00
func (x ServiceIdIndexKey) id() uint32 { return 0 }
func (x ServiceIdIndexKey) values() []interface{} { return x.vs }
func (x ServiceIdIndexKey) serviceIndexKey() {}
2024-09-26 18:01:49 -04:00
2025-10-03 14:45:52 -04:00
func (this ServiceIdIndexKey) WithId(id string) ServiceIdIndexKey {
this.vs = []interface{}{id}
2024-09-26 18:01:49 -04:00
return this
}
2025-10-03 14:45:52 -04:00
type ServiceDomainIndexKey struct {
2024-09-26 18:01:49 -04:00
vs []interface{}
}
2025-10-03 14:45:52 -04:00
func (x ServiceDomainIndexKey) id() uint32 { return 1 }
func (x ServiceDomainIndexKey) values() []interface{} { return x.vs }
func (x ServiceDomainIndexKey) serviceIndexKey() {}
2024-09-26 18:01:49 -04:00
2025-10-03 14:45:52 -04:00
func (this ServiceDomainIndexKey) WithDomain(domain string) ServiceDomainIndexKey {
this.vs = []interface{}{domain}
2024-09-26 18:01:49 -04:00
return this
}
2025-10-03 14:45:52 -04:00
type ServiceOwnerIndexKey struct {
vs []interface{}
}
2025-10-03 14:45:52 -04:00
func (x ServiceOwnerIndexKey) id() uint32 { return 2 }
func (x ServiceOwnerIndexKey) values() []interface{} { return x.vs }
func (x ServiceOwnerIndexKey) serviceIndexKey() {}
func (this ServiceOwnerIndexKey) WithOwner(owner string) ServiceOwnerIndexKey {
this.vs = []interface{}{owner}
return this
}
2025-10-03 14:45:52 -04:00
type ServiceStatusIndexKey struct {
vs []interface{}
}
2025-10-03 14:45:52 -04:00
func (x ServiceStatusIndexKey) id() uint32 { return 3 }
func (x ServiceStatusIndexKey) values() []interface{} { return x.vs }
func (x ServiceStatusIndexKey) serviceIndexKey() {}
func (this ServiceStatusIndexKey) WithStatus(status ServiceStatus) ServiceStatusIndexKey {
this.vs = []interface{}{status}
return this
}
type serviceTable struct {
table ormtable.Table
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) Insert(ctx context.Context, service *Service) error {
return this.table.Insert(ctx, service)
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) Update(ctx context.Context, service *Service) error {
return this.table.Update(ctx, service)
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) Save(ctx context.Context, service *Service) error {
return this.table.Save(ctx, service)
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) Delete(ctx context.Context, service *Service) error {
return this.table.Delete(ctx, service)
}
func (this serviceTable) Has(ctx context.Context, id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, id)
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) Get(ctx context.Context, id string) (*Service, error) {
var service Service
found, err := this.table.PrimaryKey().Get(ctx, &service, id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2025-10-03 14:45:52 -04:00
return &service, nil
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) HasByDomain(ctx context.Context, domain string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
2025-10-03 14:45:52 -04:00
domain,
)
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) GetByDomain(ctx context.Context, domain string) (*Service, error) {
var service Service
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &service,
domain,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2025-10-03 14:45:52 -04:00
return &service, nil
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) List(ctx context.Context, prefixKey ServiceIndexKey, opts ...ormlist.Option) (ServiceIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
2025-10-03 14:45:52 -04:00
return ServiceIterator{it}, err
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) ListRange(ctx context.Context, from, to ServiceIndexKey, opts ...ormlist.Option) (ServiceIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
2025-10-03 14:45:52 -04:00
return ServiceIterator{it}, err
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) DeleteBy(ctx context.Context, prefixKey ServiceIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) DeleteRange(ctx context.Context, from, to ServiceIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
2025-10-03 14:45:52 -04:00
func (this serviceTable) doNotImplement() {}
2025-10-03 14:45:52 -04:00
var _ ServiceTable = serviceTable{}
2025-10-03 14:45:52 -04:00
func NewServiceTable(db ormtable.Schema) (ServiceTable, error) {
table := db.GetTable(&Service{})
if table == nil {
2025-10-03 14:45:52 -04:00
return nil, ormerrors.TableNotFound.Wrap(string((&Service{}).ProtoReflect().Descriptor().FullName()))
}
2025-10-03 14:45:52 -04:00
return serviceTable{table}, nil
}
2025-10-03 14:45:52 -04:00
type DomainVerificationTable interface {
Insert(ctx context.Context, domainVerification *DomainVerification) error
Update(ctx context.Context, domainVerification *DomainVerification) error
Save(ctx context.Context, domainVerification *DomainVerification) error
Delete(ctx context.Context, domainVerification *DomainVerification) error
Has(ctx context.Context, domain string) (found bool, err error)
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
2025-10-03 14:45:52 -04:00
Get(ctx context.Context, domain string) (*DomainVerification, error)
List(ctx context.Context, prefixKey DomainVerificationIndexKey, opts ...ormlist.Option) (DomainVerificationIterator, error)
ListRange(ctx context.Context, from, to DomainVerificationIndexKey, opts ...ormlist.Option) (DomainVerificationIterator, error)
DeleteBy(ctx context.Context, prefixKey DomainVerificationIndexKey) error
DeleteRange(ctx context.Context, from, to DomainVerificationIndexKey) error
doNotImplement()
}
2025-10-03 14:45:52 -04:00
type DomainVerificationIterator struct {
ormtable.Iterator
}
2025-10-03 14:45:52 -04:00
func (i DomainVerificationIterator) Value() (*DomainVerification, error) {
var domainVerification DomainVerification
err := i.UnmarshalMessage(&domainVerification)
return &domainVerification, err
}
2025-10-03 14:45:52 -04:00
type DomainVerificationIndexKey interface {
id() uint32
values() []interface{}
2025-10-03 14:45:52 -04:00
domainVerificationIndexKey()
}
// primary key starting index..
2025-10-03 14:45:52 -04:00
type DomainVerificationPrimaryKey = DomainVerificationDomainIndexKey
2025-10-03 14:45:52 -04:00
type DomainVerificationDomainIndexKey struct {
vs []interface{}
}
2025-10-03 14:45:52 -04:00
func (x DomainVerificationDomainIndexKey) id() uint32 { return 0 }
func (x DomainVerificationDomainIndexKey) values() []interface{} { return x.vs }
func (x DomainVerificationDomainIndexKey) domainVerificationIndexKey() {}
2025-10-03 14:45:52 -04:00
func (this DomainVerificationDomainIndexKey) WithDomain(domain string) DomainVerificationDomainIndexKey {
this.vs = []interface{}{domain}
return this
}
2025-10-03 14:45:52 -04:00
type DomainVerificationOwnerIndexKey struct {
vs []interface{}
}
2025-10-03 14:45:52 -04:00
func (x DomainVerificationOwnerIndexKey) id() uint32 { return 1 }
func (x DomainVerificationOwnerIndexKey) values() []interface{} { return x.vs }
func (x DomainVerificationOwnerIndexKey) domainVerificationIndexKey() {}
2025-10-03 14:45:52 -04:00
func (this DomainVerificationOwnerIndexKey) WithOwner(owner string) DomainVerificationOwnerIndexKey {
this.vs = []interface{}{owner}
return this
}
2025-10-03 14:45:52 -04:00
type DomainVerificationStatusIndexKey struct {
vs []interface{}
}
func (x DomainVerificationStatusIndexKey) id() uint32 { return 2 }
func (x DomainVerificationStatusIndexKey) values() []interface{} { return x.vs }
func (x DomainVerificationStatusIndexKey) domainVerificationIndexKey() {}
func (this DomainVerificationStatusIndexKey) WithStatus(status DomainVerificationStatus) DomainVerificationStatusIndexKey {
this.vs = []interface{}{status}
return this
}
2025-10-03 14:45:52 -04:00
type domainVerificationTable struct {
2024-09-26 18:01:49 -04:00
table ormtable.Table
}
2025-10-03 14:45:52 -04:00
func (this domainVerificationTable) Insert(ctx context.Context, domainVerification *DomainVerification) error {
return this.table.Insert(ctx, domainVerification)
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
func (this domainVerificationTable) Update(ctx context.Context, domainVerification *DomainVerification) error {
return this.table.Update(ctx, domainVerification)
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
func (this domainVerificationTable) Save(ctx context.Context, domainVerification *DomainVerification) error {
return this.table.Save(ctx, domainVerification)
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
func (this domainVerificationTable) Delete(ctx context.Context, domainVerification *DomainVerification) error {
return this.table.Delete(ctx, domainVerification)
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
func (this domainVerificationTable) Has(ctx context.Context, domain string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, domain)
}
func (this domainVerificationTable) Get(ctx context.Context, domain string) (*DomainVerification, error) {
var domainVerification DomainVerification
found, err := this.table.PrimaryKey().Get(ctx, &domainVerification, domain)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &domainVerification, nil
}
func (this domainVerificationTable) List(ctx context.Context, prefixKey DomainVerificationIndexKey, opts ...ormlist.Option) (DomainVerificationIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return DomainVerificationIterator{it}, err
}
func (this domainVerificationTable) ListRange(ctx context.Context, from, to DomainVerificationIndexKey, opts ...ormlist.Option) (DomainVerificationIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return DomainVerificationIterator{it}, err
}
func (this domainVerificationTable) DeleteBy(ctx context.Context, prefixKey DomainVerificationIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this domainVerificationTable) DeleteRange(ctx context.Context, from, to DomainVerificationIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this domainVerificationTable) doNotImplement() {}
var _ DomainVerificationTable = domainVerificationTable{}
func NewDomainVerificationTable(db ormtable.Schema) (DomainVerificationTable, error) {
table := db.GetTable(&DomainVerification{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&DomainVerification{}).ProtoReflect().Descriptor().FullName()))
}
return domainVerificationTable{table}, nil
}
type ServiceCapabilityTable interface {
Insert(ctx context.Context, serviceCapability *ServiceCapability) error
Update(ctx context.Context, serviceCapability *ServiceCapability) error
Save(ctx context.Context, serviceCapability *ServiceCapability) error
Delete(ctx context.Context, serviceCapability *ServiceCapability) error
Has(ctx context.Context, capability_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, capability_id string) (*ServiceCapability, error)
List(ctx context.Context, prefixKey ServiceCapabilityIndexKey, opts ...ormlist.Option) (ServiceCapabilityIterator, error)
ListRange(ctx context.Context, from, to ServiceCapabilityIndexKey, opts ...ormlist.Option) (ServiceCapabilityIterator, error)
DeleteBy(ctx context.Context, prefixKey ServiceCapabilityIndexKey) error
DeleteRange(ctx context.Context, from, to ServiceCapabilityIndexKey) error
doNotImplement()
}
type ServiceCapabilityIterator struct {
ormtable.Iterator
}
func (i ServiceCapabilityIterator) Value() (*ServiceCapability, error) {
var serviceCapability ServiceCapability
err := i.UnmarshalMessage(&serviceCapability)
return &serviceCapability, err
}
type ServiceCapabilityIndexKey interface {
id() uint32
values() []interface{}
serviceCapabilityIndexKey()
}
// primary key starting index..
type ServiceCapabilityPrimaryKey = ServiceCapabilityCapabilityIdIndexKey
type ServiceCapabilityCapabilityIdIndexKey struct {
vs []interface{}
}
func (x ServiceCapabilityCapabilityIdIndexKey) id() uint32 { return 0 }
func (x ServiceCapabilityCapabilityIdIndexKey) values() []interface{} { return x.vs }
func (x ServiceCapabilityCapabilityIdIndexKey) serviceCapabilityIndexKey() {}
func (this ServiceCapabilityCapabilityIdIndexKey) WithCapabilityId(capability_id string) ServiceCapabilityCapabilityIdIndexKey {
this.vs = []interface{}{capability_id}
return this
}
type ServiceCapabilityServiceIdIndexKey struct {
vs []interface{}
}
func (x ServiceCapabilityServiceIdIndexKey) id() uint32 { return 1 }
func (x ServiceCapabilityServiceIdIndexKey) values() []interface{} { return x.vs }
func (x ServiceCapabilityServiceIdIndexKey) serviceCapabilityIndexKey() {}
func (this ServiceCapabilityServiceIdIndexKey) WithServiceId(service_id string) ServiceCapabilityServiceIdIndexKey {
this.vs = []interface{}{service_id}
return this
}
type ServiceCapabilityOwnerIndexKey struct {
vs []interface{}
}
func (x ServiceCapabilityOwnerIndexKey) id() uint32 { return 2 }
func (x ServiceCapabilityOwnerIndexKey) values() []interface{} { return x.vs }
func (x ServiceCapabilityOwnerIndexKey) serviceCapabilityIndexKey() {}
func (this ServiceCapabilityOwnerIndexKey) WithOwner(owner string) ServiceCapabilityOwnerIndexKey {
this.vs = []interface{}{owner}
return this
}
type ServiceCapabilityRevokedIndexKey struct {
vs []interface{}
}
func (x ServiceCapabilityRevokedIndexKey) id() uint32 { return 3 }
func (x ServiceCapabilityRevokedIndexKey) values() []interface{} { return x.vs }
func (x ServiceCapabilityRevokedIndexKey) serviceCapabilityIndexKey() {}
func (this ServiceCapabilityRevokedIndexKey) WithRevoked(revoked bool) ServiceCapabilityRevokedIndexKey {
this.vs = []interface{}{revoked}
return this
}
type serviceCapabilityTable struct {
table ormtable.Table
}
func (this serviceCapabilityTable) Insert(ctx context.Context, serviceCapability *ServiceCapability) error {
return this.table.Insert(ctx, serviceCapability)
}
func (this serviceCapabilityTable) Update(ctx context.Context, serviceCapability *ServiceCapability) error {
return this.table.Update(ctx, serviceCapability)
}
func (this serviceCapabilityTable) Save(ctx context.Context, serviceCapability *ServiceCapability) error {
return this.table.Save(ctx, serviceCapability)
}
func (this serviceCapabilityTable) Delete(ctx context.Context, serviceCapability *ServiceCapability) error {
return this.table.Delete(ctx, serviceCapability)
}
func (this serviceCapabilityTable) Has(ctx context.Context, capability_id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, capability_id)
}
func (this serviceCapabilityTable) Get(ctx context.Context, capability_id string) (*ServiceCapability, error) {
var serviceCapability ServiceCapability
found, err := this.table.PrimaryKey().Get(ctx, &serviceCapability, capability_id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &serviceCapability, nil
}
func (this serviceCapabilityTable) List(ctx context.Context, prefixKey ServiceCapabilityIndexKey, opts ...ormlist.Option) (ServiceCapabilityIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ServiceCapabilityIterator{it}, err
}
func (this serviceCapabilityTable) ListRange(ctx context.Context, from, to ServiceCapabilityIndexKey, opts ...ormlist.Option) (ServiceCapabilityIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ServiceCapabilityIterator{it}, err
}
func (this serviceCapabilityTable) DeleteBy(ctx context.Context, prefixKey ServiceCapabilityIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this serviceCapabilityTable) DeleteRange(ctx context.Context, from, to ServiceCapabilityIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this serviceCapabilityTable) doNotImplement() {}
var _ ServiceCapabilityTable = serviceCapabilityTable{}
func NewServiceCapabilityTable(db ormtable.Schema) (ServiceCapabilityTable, error) {
table := db.GetTable(&ServiceCapability{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&ServiceCapability{}).ProtoReflect().Descriptor().FullName()))
}
return serviceCapabilityTable{table}, nil
}
type ServiceResourceTable interface {
Insert(ctx context.Context, serviceResource *ServiceResource) error
Update(ctx context.Context, serviceResource *ServiceResource) error
Save(ctx context.Context, serviceResource *ServiceResource) error
Delete(ctx context.Context, serviceResource *ServiceResource) error
Has(ctx context.Context, resource_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, resource_id string) (*ServiceResource, error)
List(ctx context.Context, prefixKey ServiceResourceIndexKey, opts ...ormlist.Option) (ServiceResourceIterator, error)
ListRange(ctx context.Context, from, to ServiceResourceIndexKey, opts ...ormlist.Option) (ServiceResourceIterator, error)
DeleteBy(ctx context.Context, prefixKey ServiceResourceIndexKey) error
DeleteRange(ctx context.Context, from, to ServiceResourceIndexKey) error
doNotImplement()
}
type ServiceResourceIterator struct {
ormtable.Iterator
}
func (i ServiceResourceIterator) Value() (*ServiceResource, error) {
var serviceResource ServiceResource
err := i.UnmarshalMessage(&serviceResource)
return &serviceResource, err
}
type ServiceResourceIndexKey interface {
id() uint32
values() []interface{}
serviceResourceIndexKey()
}
// primary key starting index..
type ServiceResourcePrimaryKey = ServiceResourceResourceIdIndexKey
type ServiceResourceResourceIdIndexKey struct {
vs []interface{}
}
func (x ServiceResourceResourceIdIndexKey) id() uint32 { return 0 }
func (x ServiceResourceResourceIdIndexKey) values() []interface{} { return x.vs }
func (x ServiceResourceResourceIdIndexKey) serviceResourceIndexKey() {}
func (this ServiceResourceResourceIdIndexKey) WithResourceId(resource_id string) ServiceResourceResourceIdIndexKey {
this.vs = []interface{}{resource_id}
return this
}
type ServiceResourceServiceIdIndexKey struct {
vs []interface{}
}
func (x ServiceResourceServiceIdIndexKey) id() uint32 { return 1 }
func (x ServiceResourceServiceIdIndexKey) values() []interface{} { return x.vs }
func (x ServiceResourceServiceIdIndexKey) serviceResourceIndexKey() {}
func (this ServiceResourceServiceIdIndexKey) WithServiceId(service_id string) ServiceResourceServiceIdIndexKey {
this.vs = []interface{}{service_id}
return this
}
type ServiceResourceResourceTypeIndexKey struct {
vs []interface{}
}
func (x ServiceResourceResourceTypeIndexKey) id() uint32 { return 2 }
func (x ServiceResourceResourceTypeIndexKey) values() []interface{} { return x.vs }
func (x ServiceResourceResourceTypeIndexKey) serviceResourceIndexKey() {}
func (this ServiceResourceResourceTypeIndexKey) WithResourceType(resource_type string) ServiceResourceResourceTypeIndexKey {
this.vs = []interface{}{resource_type}
return this
}
type serviceResourceTable struct {
table ormtable.Table
}
func (this serviceResourceTable) Insert(ctx context.Context, serviceResource *ServiceResource) error {
return this.table.Insert(ctx, serviceResource)
}
func (this serviceResourceTable) Update(ctx context.Context, serviceResource *ServiceResource) error {
return this.table.Update(ctx, serviceResource)
}
func (this serviceResourceTable) Save(ctx context.Context, serviceResource *ServiceResource) error {
return this.table.Save(ctx, serviceResource)
}
func (this serviceResourceTable) Delete(ctx context.Context, serviceResource *ServiceResource) error {
return this.table.Delete(ctx, serviceResource)
}
func (this serviceResourceTable) Has(ctx context.Context, resource_id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, resource_id)
}
func (this serviceResourceTable) Get(ctx context.Context, resource_id string) (*ServiceResource, error) {
var serviceResource ServiceResource
found, err := this.table.PrimaryKey().Get(ctx, &serviceResource, resource_id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &serviceResource, nil
}
func (this serviceResourceTable) List(ctx context.Context, prefixKey ServiceResourceIndexKey, opts ...ormlist.Option) (ServiceResourceIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ServiceResourceIterator{it}, err
}
func (this serviceResourceTable) ListRange(ctx context.Context, from, to ServiceResourceIndexKey, opts ...ormlist.Option) (ServiceResourceIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ServiceResourceIterator{it}, err
}
func (this serviceResourceTable) DeleteBy(ctx context.Context, prefixKey ServiceResourceIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this serviceResourceTable) DeleteRange(ctx context.Context, from, to ServiceResourceIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this serviceResourceTable) doNotImplement() {}
var _ ServiceResourceTable = serviceResourceTable{}
func NewServiceResourceTable(db ormtable.Schema) (ServiceResourceTable, error) {
table := db.GetTable(&ServiceResource{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&ServiceResource{}).ProtoReflect().Descriptor().FullName()))
}
return serviceResourceTable{table}, nil
}
type ServiceOIDCConfigTable interface {
Insert(ctx context.Context, serviceOIDCConfig *ServiceOIDCConfig) error
Update(ctx context.Context, serviceOIDCConfig *ServiceOIDCConfig) error
Save(ctx context.Context, serviceOIDCConfig *ServiceOIDCConfig) error
Delete(ctx context.Context, serviceOIDCConfig *ServiceOIDCConfig) error
Has(ctx context.Context, service_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, service_id string) (*ServiceOIDCConfig, error)
HasByIssuer(ctx context.Context, issuer string) (found bool, err error)
// GetByIssuer returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
GetByIssuer(ctx context.Context, issuer string) (*ServiceOIDCConfig, error)
List(ctx context.Context, prefixKey ServiceOIDCConfigIndexKey, opts ...ormlist.Option) (ServiceOIDCConfigIterator, error)
ListRange(ctx context.Context, from, to ServiceOIDCConfigIndexKey, opts ...ormlist.Option) (ServiceOIDCConfigIterator, error)
DeleteBy(ctx context.Context, prefixKey ServiceOIDCConfigIndexKey) error
DeleteRange(ctx context.Context, from, to ServiceOIDCConfigIndexKey) error
doNotImplement()
}
type ServiceOIDCConfigIterator struct {
ormtable.Iterator
}
func (i ServiceOIDCConfigIterator) Value() (*ServiceOIDCConfig, error) {
var serviceOIDCConfig ServiceOIDCConfig
err := i.UnmarshalMessage(&serviceOIDCConfig)
return &serviceOIDCConfig, err
}
type ServiceOIDCConfigIndexKey interface {
id() uint32
values() []interface{}
serviceOIDCConfigIndexKey()
}
// primary key starting index..
type ServiceOIDCConfigPrimaryKey = ServiceOIDCConfigServiceIdIndexKey
type ServiceOIDCConfigServiceIdIndexKey struct {
vs []interface{}
}
func (x ServiceOIDCConfigServiceIdIndexKey) id() uint32 { return 0 }
func (x ServiceOIDCConfigServiceIdIndexKey) values() []interface{} { return x.vs }
func (x ServiceOIDCConfigServiceIdIndexKey) serviceOIDCConfigIndexKey() {}
func (this ServiceOIDCConfigServiceIdIndexKey) WithServiceId(service_id string) ServiceOIDCConfigServiceIdIndexKey {
this.vs = []interface{}{service_id}
return this
}
type ServiceOIDCConfigIssuerIndexKey struct {
vs []interface{}
}
func (x ServiceOIDCConfigIssuerIndexKey) id() uint32 { return 1 }
func (x ServiceOIDCConfigIssuerIndexKey) values() []interface{} { return x.vs }
func (x ServiceOIDCConfigIssuerIndexKey) serviceOIDCConfigIndexKey() {}
func (this ServiceOIDCConfigIssuerIndexKey) WithIssuer(issuer string) ServiceOIDCConfigIssuerIndexKey {
this.vs = []interface{}{issuer}
return this
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
type serviceOIDCConfigTable struct {
table ormtable.Table
}
func (this serviceOIDCConfigTable) Insert(ctx context.Context, serviceOIDCConfig *ServiceOIDCConfig) error {
return this.table.Insert(ctx, serviceOIDCConfig)
}
func (this serviceOIDCConfigTable) Update(ctx context.Context, serviceOIDCConfig *ServiceOIDCConfig) error {
return this.table.Update(ctx, serviceOIDCConfig)
}
func (this serviceOIDCConfigTable) Save(ctx context.Context, serviceOIDCConfig *ServiceOIDCConfig) error {
return this.table.Save(ctx, serviceOIDCConfig)
}
func (this serviceOIDCConfigTable) Delete(ctx context.Context, serviceOIDCConfig *ServiceOIDCConfig) error {
return this.table.Delete(ctx, serviceOIDCConfig)
}
func (this serviceOIDCConfigTable) Has(ctx context.Context, service_id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, service_id)
}
func (this serviceOIDCConfigTable) Get(ctx context.Context, service_id string) (*ServiceOIDCConfig, error) {
var serviceOIDCConfig ServiceOIDCConfig
found, err := this.table.PrimaryKey().Get(ctx, &serviceOIDCConfig, service_id)
2024-09-26 18:01:49 -04:00
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2025-10-03 14:45:52 -04:00
return &serviceOIDCConfig, nil
}
2025-10-03 14:45:52 -04:00
func (this serviceOIDCConfigTable) HasByIssuer(ctx context.Context, issuer string) (found bool, err error) {
return this.table.GetIndexByID(1).(ormtable.UniqueIndex).Has(ctx,
2025-10-03 14:45:52 -04:00
issuer,
)
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
func (this serviceOIDCConfigTable) GetByIssuer(ctx context.Context, issuer string) (*ServiceOIDCConfig, error) {
var serviceOIDCConfig ServiceOIDCConfig
found, err := this.table.GetIndexByID(1).(ormtable.UniqueIndex).Get(ctx, &serviceOIDCConfig,
issuer,
)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
2025-10-03 14:45:52 -04:00
return &serviceOIDCConfig, nil
}
2025-10-03 14:45:52 -04:00
func (this serviceOIDCConfigTable) List(ctx context.Context, prefixKey ServiceOIDCConfigIndexKey, opts ...ormlist.Option) (ServiceOIDCConfigIterator, error) {
2024-09-26 18:01:49 -04:00
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
2025-10-03 14:45:52 -04:00
return ServiceOIDCConfigIterator{it}, err
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
func (this serviceOIDCConfigTable) ListRange(ctx context.Context, from, to ServiceOIDCConfigIndexKey, opts ...ormlist.Option) (ServiceOIDCConfigIterator, error) {
2024-09-26 18:01:49 -04:00
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
2025-10-03 14:45:52 -04:00
return ServiceOIDCConfigIterator{it}, err
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
func (this serviceOIDCConfigTable) DeleteBy(ctx context.Context, prefixKey ServiceOIDCConfigIndexKey) error {
2024-09-26 18:01:49 -04:00
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
2025-10-03 14:45:52 -04:00
func (this serviceOIDCConfigTable) DeleteRange(ctx context.Context, from, to ServiceOIDCConfigIndexKey) error {
2024-09-26 18:01:49 -04:00
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
2025-10-03 14:45:52 -04:00
func (this serviceOIDCConfigTable) doNotImplement() {}
2024-09-26 18:01:49 -04:00
2025-10-03 14:45:52 -04:00
var _ ServiceOIDCConfigTable = serviceOIDCConfigTable{}
2024-09-26 18:01:49 -04:00
2025-10-03 14:45:52 -04:00
func NewServiceOIDCConfigTable(db ormtable.Schema) (ServiceOIDCConfigTable, error) {
table := db.GetTable(&ServiceOIDCConfig{})
2024-09-26 18:01:49 -04:00
if table == nil {
2025-10-03 14:45:52 -04:00
return nil, ormerrors.TableNotFound.Wrap(string((&ServiceOIDCConfig{}).ProtoReflect().Descriptor().FullName()))
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
return serviceOIDCConfigTable{table}, nil
}
type ServiceJWKSTable interface {
Insert(ctx context.Context, serviceJWKS *ServiceJWKS) error
Update(ctx context.Context, serviceJWKS *ServiceJWKS) error
Save(ctx context.Context, serviceJWKS *ServiceJWKS) error
Delete(ctx context.Context, serviceJWKS *ServiceJWKS) error
Has(ctx context.Context, service_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, service_id string) (*ServiceJWKS, error)
List(ctx context.Context, prefixKey ServiceJWKSIndexKey, opts ...ormlist.Option) (ServiceJWKSIterator, error)
ListRange(ctx context.Context, from, to ServiceJWKSIndexKey, opts ...ormlist.Option) (ServiceJWKSIterator, error)
DeleteBy(ctx context.Context, prefixKey ServiceJWKSIndexKey) error
DeleteRange(ctx context.Context, from, to ServiceJWKSIndexKey) error
doNotImplement()
}
type ServiceJWKSIterator struct {
ormtable.Iterator
}
func (i ServiceJWKSIterator) Value() (*ServiceJWKS, error) {
var serviceJWKS ServiceJWKS
err := i.UnmarshalMessage(&serviceJWKS)
return &serviceJWKS, err
}
type ServiceJWKSIndexKey interface {
id() uint32
values() []interface{}
serviceJWKSIndexKey()
}
// primary key starting index..
type ServiceJWKSPrimaryKey = ServiceJWKSServiceIdIndexKey
type ServiceJWKSServiceIdIndexKey struct {
vs []interface{}
}
func (x ServiceJWKSServiceIdIndexKey) id() uint32 { return 0 }
func (x ServiceJWKSServiceIdIndexKey) values() []interface{} { return x.vs }
func (x ServiceJWKSServiceIdIndexKey) serviceJWKSIndexKey() {}
func (this ServiceJWKSServiceIdIndexKey) WithServiceId(service_id string) ServiceJWKSServiceIdIndexKey {
this.vs = []interface{}{service_id}
return this
}
type serviceJWKSTable struct {
table ormtable.Table
}
func (this serviceJWKSTable) Insert(ctx context.Context, serviceJWKS *ServiceJWKS) error {
return this.table.Insert(ctx, serviceJWKS)
}
func (this serviceJWKSTable) Update(ctx context.Context, serviceJWKS *ServiceJWKS) error {
return this.table.Update(ctx, serviceJWKS)
}
func (this serviceJWKSTable) Save(ctx context.Context, serviceJWKS *ServiceJWKS) error {
return this.table.Save(ctx, serviceJWKS)
}
func (this serviceJWKSTable) Delete(ctx context.Context, serviceJWKS *ServiceJWKS) error {
return this.table.Delete(ctx, serviceJWKS)
}
func (this serviceJWKSTable) Has(ctx context.Context, service_id string) (found bool, err error) {
return this.table.PrimaryKey().Has(ctx, service_id)
}
func (this serviceJWKSTable) Get(ctx context.Context, service_id string) (*ServiceJWKS, error) {
var serviceJWKS ServiceJWKS
found, err := this.table.PrimaryKey().Get(ctx, &serviceJWKS, service_id)
if err != nil {
return nil, err
}
if !found {
return nil, ormerrors.NotFound
}
return &serviceJWKS, nil
}
func (this serviceJWKSTable) List(ctx context.Context, prefixKey ServiceJWKSIndexKey, opts ...ormlist.Option) (ServiceJWKSIterator, error) {
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
return ServiceJWKSIterator{it}, err
}
func (this serviceJWKSTable) ListRange(ctx context.Context, from, to ServiceJWKSIndexKey, opts ...ormlist.Option) (ServiceJWKSIterator, error) {
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
return ServiceJWKSIterator{it}, err
}
func (this serviceJWKSTable) DeleteBy(ctx context.Context, prefixKey ServiceJWKSIndexKey) error {
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
}
func (this serviceJWKSTable) DeleteRange(ctx context.Context, from, to ServiceJWKSIndexKey) error {
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
}
func (this serviceJWKSTable) doNotImplement() {}
var _ ServiceJWKSTable = serviceJWKSTable{}
func NewServiceJWKSTable(db ormtable.Schema) (ServiceJWKSTable, error) {
table := db.GetTable(&ServiceJWKS{})
if table == nil {
return nil, ormerrors.TableNotFound.Wrap(string((&ServiceJWKS{}).ProtoReflect().Descriptor().FullName()))
}
return serviceJWKSTable{table}, nil
2024-09-26 18:01:49 -04:00
}
type StateStore interface {
2025-10-03 14:45:52 -04:00
ServiceTable() ServiceTable
DomainVerificationTable() DomainVerificationTable
ServiceCapabilityTable() ServiceCapabilityTable
ServiceResourceTable() ServiceResourceTable
ServiceOIDCConfigTable() ServiceOIDCConfigTable
ServiceJWKSTable() ServiceJWKSTable
2024-09-26 18:01:49 -04:00
doNotImplement()
}
type stateStore struct {
2025-10-03 14:45:52 -04:00
service ServiceTable
domainVerification DomainVerificationTable
serviceCapability ServiceCapabilityTable
serviceResource ServiceResourceTable
serviceOIDCConfig ServiceOIDCConfigTable
serviceJWKS ServiceJWKSTable
}
func (x stateStore) ServiceTable() ServiceTable {
return x.service
}
func (x stateStore) DomainVerificationTable() DomainVerificationTable {
return x.domainVerification
2024-09-26 18:01:49 -04:00
}
2025-10-03 14:45:52 -04:00
func (x stateStore) ServiceCapabilityTable() ServiceCapabilityTable {
return x.serviceCapability
}
2025-10-03 14:45:52 -04:00
func (x stateStore) ServiceResourceTable() ServiceResourceTable {
return x.serviceResource
}
func (x stateStore) ServiceOIDCConfigTable() ServiceOIDCConfigTable {
return x.serviceOIDCConfig
}
func (x stateStore) ServiceJWKSTable() ServiceJWKSTable {
return x.serviceJWKS
2024-09-26 18:01:49 -04:00
}
func (stateStore) doNotImplement() {}
var _ StateStore = stateStore{}
func NewStateStore(db ormtable.Schema) (StateStore, error) {
2025-10-03 14:45:52 -04:00
serviceTable, err := NewServiceTable(db)
if err != nil {
return nil, err
}
domainVerificationTable, err := NewDomainVerificationTable(db)
if err != nil {
return nil, err
}
serviceCapabilityTable, err := NewServiceCapabilityTable(db)
if err != nil {
return nil, err
}
serviceResourceTable, err := NewServiceResourceTable(db)
if err != nil {
return nil, err
}
serviceOIDCConfigTable, err := NewServiceOIDCConfigTable(db)
if err != nil {
return nil, err
}
2025-10-03 14:45:52 -04:00
serviceJWKSTable, err := NewServiceJWKSTable(db)
2024-09-26 18:01:49 -04:00
if err != nil {
return nil, err
}
return stateStore{
2025-10-03 14:45:52 -04:00
serviceTable,
domainVerificationTable,
serviceCapabilityTable,
serviceResourceTable,
serviceOIDCConfigTable,
serviceJWKSTable,
2024-09-26 18:01:49 -04:00
}, nil
}