mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
feature/proxied registration (#26)
* chore: ignore mprocs configuration files * feat(macaroon): add macaroon module * chore: update module dependencies
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
// Code generated by protoc-gen-go-cosmos-orm. DO NOT EDIT.
|
||||
|
||||
package servicev1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
ormlist "cosmossdk.io/orm/model/ormlist"
|
||||
ormtable "cosmossdk.io/orm/model/ormtable"
|
||||
ormerrors "cosmossdk.io/orm/types/ormerrors"
|
||||
)
|
||||
|
||||
type ExampleDataTable interface {
|
||||
Insert(ctx context.Context, exampleData *ExampleData) error
|
||||
Update(ctx context.Context, exampleData *ExampleData) error
|
||||
Save(ctx context.Context, exampleData *ExampleData) error
|
||||
Delete(ctx context.Context, exampleData *ExampleData) error
|
||||
Has(ctx context.Context, account []byte) (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, account []byte) (*ExampleData, error)
|
||||
List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error)
|
||||
ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type ExampleDataIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i ExampleDataIterator) Value() (*ExampleData, error) {
|
||||
var exampleData ExampleData
|
||||
err := i.UnmarshalMessage(&exampleData)
|
||||
return &exampleData, err
|
||||
}
|
||||
|
||||
type ExampleDataIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
exampleDataIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type ExampleDataPrimaryKey = ExampleDataAccountIndexKey
|
||||
|
||||
type ExampleDataAccountIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ExampleDataAccountIndexKey) id() uint32 { return 0 }
|
||||
func (x ExampleDataAccountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ExampleDataAccountIndexKey) exampleDataIndexKey() {}
|
||||
|
||||
func (this ExampleDataAccountIndexKey) WithAccount(account []byte) ExampleDataAccountIndexKey {
|
||||
this.vs = []interface{}{account}
|
||||
return this
|
||||
}
|
||||
|
||||
type ExampleDataAmountIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ExampleDataAmountIndexKey) id() uint32 { return 1 }
|
||||
func (x ExampleDataAmountIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ExampleDataAmountIndexKey) exampleDataIndexKey() {}
|
||||
|
||||
func (this ExampleDataAmountIndexKey) WithAmount(amount uint64) ExampleDataAmountIndexKey {
|
||||
this.vs = []interface{}{amount}
|
||||
return this
|
||||
}
|
||||
|
||||
type exampleDataTable struct {
|
||||
table ormtable.Table
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Insert(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Insert(ctx, exampleData)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Update(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Update(ctx, exampleData)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Save(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Save(ctx, exampleData)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Delete(ctx context.Context, exampleData *ExampleData) error {
|
||||
return this.table.Delete(ctx, exampleData)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Has(ctx context.Context, account []byte) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, account)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) Get(ctx context.Context, account []byte) (*ExampleData, error) {
|
||||
var exampleData ExampleData
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &exampleData, account)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &exampleData, nil
|
||||
}
|
||||
|
||||
func (this exampleDataTable) List(ctx context.Context, prefixKey ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) {
|
||||
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
|
||||
return ExampleDataIterator{it}, err
|
||||
}
|
||||
|
||||
func (this exampleDataTable) ListRange(ctx context.Context, from, to ExampleDataIndexKey, opts ...ormlist.Option) (ExampleDataIterator, error) {
|
||||
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
|
||||
return ExampleDataIterator{it}, err
|
||||
}
|
||||
|
||||
func (this exampleDataTable) DeleteBy(ctx context.Context, prefixKey ExampleDataIndexKey) error {
|
||||
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||
}
|
||||
|
||||
func (this exampleDataTable) DeleteRange(ctx context.Context, from, to ExampleDataIndexKey) error {
|
||||
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||
}
|
||||
|
||||
func (this exampleDataTable) doNotImplement() {}
|
||||
|
||||
var _ ExampleDataTable = exampleDataTable{}
|
||||
|
||||
func NewExampleDataTable(db ormtable.Schema) (ExampleDataTable, error) {
|
||||
table := db.GetTable(&ExampleData{})
|
||||
if table == nil {
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&ExampleData{}).ProtoReflect().Descriptor().FullName()))
|
||||
}
|
||||
return exampleDataTable{table}, nil
|
||||
}
|
||||
|
||||
type StateStore interface {
|
||||
ExampleDataTable() ExampleDataTable
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type stateStore struct {
|
||||
exampleData ExampleDataTable
|
||||
}
|
||||
|
||||
func (x stateStore) ExampleDataTable() ExampleDataTable {
|
||||
return x.exampleData
|
||||
}
|
||||
|
||||
func (stateStore) doNotImplement() {}
|
||||
|
||||
var _ StateStore = stateStore{}
|
||||
|
||||
func NewStateStore(db ormtable.Schema) (StateStore, error) {
|
||||
exampleDataTable, err := NewExampleDataTable(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return stateStore{
|
||||
exampleDataTable,
|
||||
}, nil
|
||||
}
|
||||
Reference in New Issue
Block a user