mirror of
https://github.com/sonr-io/sonr.git
synced 2026-08-02 17:31:39 +00:00
(no commit message provided)
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,267 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc (unknown)
|
||||
// source: did/v1/query.proto
|
||||
|
||||
package didv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Query_Params_FullMethodName = "/did.v1.Query/Params"
|
||||
Query_PropertyExists_FullMethodName = "/did.v1.Query/PropertyExists"
|
||||
Query_ResolveIdentifier_FullMethodName = "/did.v1.Query/ResolveIdentifier"
|
||||
Query_LoginOptions_FullMethodName = "/did.v1.Query/LoginOptions"
|
||||
Query_RegisterOptions_FullMethodName = "/did.v1.Query/RegisterOptions"
|
||||
)
|
||||
|
||||
// QueryClient is the client API for Query service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type QueryClient interface {
|
||||
// Params queries all parameters of the module.
|
||||
Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error)
|
||||
// Exists queries if an id exists.
|
||||
PropertyExists(ctx context.Context, in *QueryExistsRequest, opts ...grpc.CallOption) (*QueryExistsResponse, error)
|
||||
// Resolve queries the DID document by its id.
|
||||
ResolveIdentifier(ctx context.Context, in *QueryResolveRequest, opts ...grpc.CallOption) (*QueryResolveResponse, error)
|
||||
// LoginOptions queries the PublicKeyCredentialAttestationOptions for starting a login flow.
|
||||
LoginOptions(ctx context.Context, in *QueryLoginOptionsRequest, opts ...grpc.CallOption) (*QueryLoginOptionsResponse, error)
|
||||
// RegisterOptions queries the PublicKeyCredentialCreationOptions for starting a register flow.
|
||||
RegisterOptions(ctx context.Context, in *QueryRegisterOptionsRequest, opts ...grpc.CallOption) (*QueryRegisterOptionsResponse, error)
|
||||
}
|
||||
|
||||
type queryClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewQueryClient(cc grpc.ClientConnInterface) QueryClient {
|
||||
return &queryClient{cc}
|
||||
}
|
||||
|
||||
func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) {
|
||||
out := new(QueryParamsResponse)
|
||||
err := c.cc.Invoke(ctx, Query_Params_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) PropertyExists(ctx context.Context, in *QueryExistsRequest, opts ...grpc.CallOption) (*QueryExistsResponse, error) {
|
||||
out := new(QueryExistsResponse)
|
||||
err := c.cc.Invoke(ctx, Query_PropertyExists_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) ResolveIdentifier(ctx context.Context, in *QueryResolveRequest, opts ...grpc.CallOption) (*QueryResolveResponse, error) {
|
||||
out := new(QueryResolveResponse)
|
||||
err := c.cc.Invoke(ctx, Query_ResolveIdentifier_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) LoginOptions(ctx context.Context, in *QueryLoginOptionsRequest, opts ...grpc.CallOption) (*QueryLoginOptionsResponse, error) {
|
||||
out := new(QueryLoginOptionsResponse)
|
||||
err := c.cc.Invoke(ctx, Query_LoginOptions_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *queryClient) RegisterOptions(ctx context.Context, in *QueryRegisterOptionsRequest, opts ...grpc.CallOption) (*QueryRegisterOptionsResponse, error) {
|
||||
out := new(QueryRegisterOptionsResponse)
|
||||
err := c.cc.Invoke(ctx, Query_RegisterOptions_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// QueryServer is the server API for Query service.
|
||||
// All implementations must embed UnimplementedQueryServer
|
||||
// for forward compatibility
|
||||
type QueryServer interface {
|
||||
// Params queries all parameters of the module.
|
||||
Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error)
|
||||
// Exists queries if an id exists.
|
||||
PropertyExists(context.Context, *QueryExistsRequest) (*QueryExistsResponse, error)
|
||||
// Resolve queries the DID document by its id.
|
||||
ResolveIdentifier(context.Context, *QueryResolveRequest) (*QueryResolveResponse, error)
|
||||
// LoginOptions queries the PublicKeyCredentialAttestationOptions for starting a login flow.
|
||||
LoginOptions(context.Context, *QueryLoginOptionsRequest) (*QueryLoginOptionsResponse, error)
|
||||
// RegisterOptions queries the PublicKeyCredentialCreationOptions for starting a register flow.
|
||||
RegisterOptions(context.Context, *QueryRegisterOptionsRequest) (*QueryRegisterOptionsResponse, error)
|
||||
mustEmbedUnimplementedQueryServer()
|
||||
}
|
||||
|
||||
// UnimplementedQueryServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedQueryServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedQueryServer) Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method Params not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) PropertyExists(context.Context, *QueryExistsRequest) (*QueryExistsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method PropertyExists not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) ResolveIdentifier(context.Context, *QueryResolveRequest) (*QueryResolveResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method ResolveIdentifier not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) LoginOptions(context.Context, *QueryLoginOptionsRequest) (*QueryLoginOptionsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method LoginOptions not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) RegisterOptions(context.Context, *QueryRegisterOptionsRequest) (*QueryRegisterOptionsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method RegisterOptions not implemented")
|
||||
}
|
||||
func (UnimplementedQueryServer) mustEmbedUnimplementedQueryServer() {}
|
||||
|
||||
// UnsafeQueryServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to QueryServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeQueryServer interface {
|
||||
mustEmbedUnimplementedQueryServer()
|
||||
}
|
||||
|
||||
func RegisterQueryServer(s grpc.ServiceRegistrar, srv QueryServer) {
|
||||
s.RegisterService(&Query_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryParamsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).Params(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_Params_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_PropertyExists_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryExistsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).PropertyExists(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_PropertyExists_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).PropertyExists(ctx, req.(*QueryExistsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_ResolveIdentifier_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryResolveRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).ResolveIdentifier(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_ResolveIdentifier_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).ResolveIdentifier(ctx, req.(*QueryResolveRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_LoginOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryLoginOptionsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).LoginOptions(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_LoginOptions_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).LoginOptions(ctx, req.(*QueryLoginOptionsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Query_RegisterOptions_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(QueryRegisterOptionsRequest)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(QueryServer).RegisterOptions(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Query_RegisterOptions_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(QueryServer).RegisterOptions(ctx, req.(*QueryRegisterOptionsRequest))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Query_ServiceDesc is the grpc.ServiceDesc for Query service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Query_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "did.v1.Query",
|
||||
HandlerType: (*QueryServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "Params",
|
||||
Handler: _Query_Params_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "PropertyExists",
|
||||
Handler: _Query_PropertyExists_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "ResolveIdentifier",
|
||||
Handler: _Query_ResolveIdentifier_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "LoginOptions",
|
||||
Handler: _Query_LoginOptions_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "RegisterOptions",
|
||||
Handler: _Query_RegisterOptions_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "did/v1/query.proto",
|
||||
}
|
||||
@@ -0,0 +1,531 @@
|
||||
// Code generated by protoc-gen-go-cosmos-orm. DO NOT EDIT.
|
||||
|
||||
package didv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
ormlist "cosmossdk.io/orm/model/ormlist"
|
||||
ormtable "cosmossdk.io/orm/model/ormtable"
|
||||
ormerrors "cosmossdk.io/orm/types/ormerrors"
|
||||
)
|
||||
|
||||
type AttestationTable interface {
|
||||
Insert(ctx context.Context, attestation *Attestation) error
|
||||
Update(ctx context.Context, attestation *Attestation) error
|
||||
Save(ctx context.Context, attestation *Attestation) error
|
||||
Delete(ctx context.Context, attestation *Attestation) 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) (*Attestation, error)
|
||||
List(ctx context.Context, prefixKey AttestationIndexKey, opts ...ormlist.Option) (AttestationIterator, error)
|
||||
ListRange(ctx context.Context, from, to AttestationIndexKey, opts ...ormlist.Option) (AttestationIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey AttestationIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to AttestationIndexKey) error
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type AttestationIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i AttestationIterator) Value() (*Attestation, error) {
|
||||
var attestation Attestation
|
||||
err := i.UnmarshalMessage(&attestation)
|
||||
return &attestation, err
|
||||
}
|
||||
|
||||
type AttestationIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
attestationIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type AttestationPrimaryKey = AttestationIdIndexKey
|
||||
|
||||
type AttestationIdIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x AttestationIdIndexKey) id() uint32 { return 0 }
|
||||
func (x AttestationIdIndexKey) values() []interface{} { return x.vs }
|
||||
func (x AttestationIdIndexKey) attestationIndexKey() {}
|
||||
|
||||
func (this AttestationIdIndexKey) WithId(id string) AttestationIdIndexKey {
|
||||
this.vs = []interface{}{id}
|
||||
return this
|
||||
}
|
||||
|
||||
type attestationTable struct {
|
||||
table ormtable.Table
|
||||
}
|
||||
|
||||
func (this attestationTable) Insert(ctx context.Context, attestation *Attestation) error {
|
||||
return this.table.Insert(ctx, attestation)
|
||||
}
|
||||
|
||||
func (this attestationTable) Update(ctx context.Context, attestation *Attestation) error {
|
||||
return this.table.Update(ctx, attestation)
|
||||
}
|
||||
|
||||
func (this attestationTable) Save(ctx context.Context, attestation *Attestation) error {
|
||||
return this.table.Save(ctx, attestation)
|
||||
}
|
||||
|
||||
func (this attestationTable) Delete(ctx context.Context, attestation *Attestation) error {
|
||||
return this.table.Delete(ctx, attestation)
|
||||
}
|
||||
|
||||
func (this attestationTable) Has(ctx context.Context, id string) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, id)
|
||||
}
|
||||
|
||||
func (this attestationTable) Get(ctx context.Context, id string) (*Attestation, error) {
|
||||
var attestation Attestation
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &attestation, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &attestation, nil
|
||||
}
|
||||
|
||||
func (this attestationTable) List(ctx context.Context, prefixKey AttestationIndexKey, opts ...ormlist.Option) (AttestationIterator, error) {
|
||||
it, err := this.table.GetIndexByID(prefixKey.id()).List(ctx, prefixKey.values(), opts...)
|
||||
return AttestationIterator{it}, err
|
||||
}
|
||||
|
||||
func (this attestationTable) ListRange(ctx context.Context, from, to AttestationIndexKey, opts ...ormlist.Option) (AttestationIterator, error) {
|
||||
it, err := this.table.GetIndexByID(from.id()).ListRange(ctx, from.values(), to.values(), opts...)
|
||||
return AttestationIterator{it}, err
|
||||
}
|
||||
|
||||
func (this attestationTable) DeleteBy(ctx context.Context, prefixKey AttestationIndexKey) error {
|
||||
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||
}
|
||||
|
||||
func (this attestationTable) DeleteRange(ctx context.Context, from, to AttestationIndexKey) error {
|
||||
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||
}
|
||||
|
||||
func (this attestationTable) doNotImplement() {}
|
||||
|
||||
var _ AttestationTable = attestationTable{}
|
||||
|
||||
func NewAttestationTable(db ormtable.Schema) (AttestationTable, error) {
|
||||
table := db.GetTable(&Attestation{})
|
||||
if table == nil {
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&Attestation{}).ProtoReflect().Descriptor().FullName()))
|
||||
}
|
||||
return attestationTable{table}, nil
|
||||
}
|
||||
|
||||
type ControllerTable interface {
|
||||
Insert(ctx context.Context, controller *Controller) error
|
||||
Update(ctx context.Context, controller *Controller) error
|
||||
Save(ctx context.Context, controller *Controller) error
|
||||
Delete(ctx context.Context, controller *Controller) error
|
||||
Has(ctx context.Context, id string) (found bool, err error)
|
||||
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
Get(ctx context.Context, id string) (*Controller, error)
|
||||
List(ctx context.Context, prefixKey ControllerIndexKey, opts ...ormlist.Option) (ControllerIterator, error)
|
||||
ListRange(ctx context.Context, from, to ControllerIndexKey, opts ...ormlist.Option) (ControllerIterator, error)
|
||||
DeleteBy(ctx context.Context, prefixKey ControllerIndexKey) error
|
||||
DeleteRange(ctx context.Context, from, to ControllerIndexKey) error
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type ControllerIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i ControllerIterator) Value() (*Controller, error) {
|
||||
var controller Controller
|
||||
err := i.UnmarshalMessage(&controller)
|
||||
return &controller, err
|
||||
}
|
||||
|
||||
type ControllerIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
controllerIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type ControllerPrimaryKey = ControllerIdIndexKey
|
||||
|
||||
type ControllerIdIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ControllerIdIndexKey) id() uint32 { return 0 }
|
||||
func (x ControllerIdIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ControllerIdIndexKey) controllerIndexKey() {}
|
||||
|
||||
func (this ControllerIdIndexKey) WithId(id string) ControllerIdIndexKey {
|
||||
this.vs = []interface{}{id}
|
||||
return this
|
||||
}
|
||||
|
||||
type controllerTable struct {
|
||||
table ormtable.Table
|
||||
}
|
||||
|
||||
func (this controllerTable) Insert(ctx context.Context, controller *Controller) error {
|
||||
return this.table.Insert(ctx, controller)
|
||||
}
|
||||
|
||||
func (this controllerTable) Update(ctx context.Context, controller *Controller) error {
|
||||
return this.table.Update(ctx, controller)
|
||||
}
|
||||
|
||||
func (this controllerTable) Save(ctx context.Context, controller *Controller) error {
|
||||
return this.table.Save(ctx, controller)
|
||||
}
|
||||
|
||||
func (this controllerTable) Delete(ctx context.Context, controller *Controller) error {
|
||||
return this.table.Delete(ctx, controller)
|
||||
}
|
||||
|
||||
func (this controllerTable) Has(ctx context.Context, id string) (found bool, err error) {
|
||||
return this.table.PrimaryKey().Has(ctx, id)
|
||||
}
|
||||
|
||||
func (this controllerTable) Get(ctx context.Context, id string) (*Controller, error) {
|
||||
var controller Controller
|
||||
found, err := this.table.PrimaryKey().Get(ctx, &controller, id)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !found {
|
||||
return nil, ormerrors.NotFound
|
||||
}
|
||||
return &controller, nil
|
||||
}
|
||||
|
||||
func (this controllerTable) 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)
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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)
|
||||
// Get returns nil and an error which responds true to ormerrors.IsNotFound() if the record was not found.
|
||||
Get(ctx context.Context, id 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
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type ServiceIterator struct {
|
||||
ormtable.Iterator
|
||||
}
|
||||
|
||||
func (i ServiceIterator) Value() (*Service, error) {
|
||||
var service Service
|
||||
err := i.UnmarshalMessage(&service)
|
||||
return &service, err
|
||||
}
|
||||
|
||||
type ServiceIndexKey interface {
|
||||
id() uint32
|
||||
values() []interface{}
|
||||
serviceIndexKey()
|
||||
}
|
||||
|
||||
// primary key starting index..
|
||||
type ServicePrimaryKey = ServiceIdIndexKey
|
||||
|
||||
type ServiceIdIndexKey struct {
|
||||
vs []interface{}
|
||||
}
|
||||
|
||||
func (x ServiceIdIndexKey) id() uint32 { return 0 }
|
||||
func (x ServiceIdIndexKey) values() []interface{} { return x.vs }
|
||||
func (x ServiceIdIndexKey) serviceIndexKey() {}
|
||||
|
||||
func (this ServiceIdIndexKey) WithId(id string) ServiceIdIndexKey {
|
||||
this.vs = []interface{}{id}
|
||||
return this
|
||||
}
|
||||
|
||||
type serviceTable struct {
|
||||
table ormtable.Table
|
||||
}
|
||||
|
||||
func (this serviceTable) Insert(ctx context.Context, service *Service) error {
|
||||
return this.table.Insert(ctx, service)
|
||||
}
|
||||
|
||||
func (this serviceTable) Update(ctx context.Context, service *Service) error {
|
||||
return this.table.Update(ctx, service)
|
||||
}
|
||||
|
||||
func (this serviceTable) Save(ctx context.Context, service *Service) error {
|
||||
return this.table.Save(ctx, service)
|
||||
}
|
||||
|
||||
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)
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
return &service, nil
|
||||
}
|
||||
|
||||
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...)
|
||||
return ServiceIterator{it}, err
|
||||
}
|
||||
|
||||
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...)
|
||||
return ServiceIterator{it}, err
|
||||
}
|
||||
|
||||
func (this serviceTable) DeleteBy(ctx context.Context, prefixKey ServiceIndexKey) error {
|
||||
return this.table.GetIndexByID(prefixKey.id()).DeleteBy(ctx, prefixKey.values()...)
|
||||
}
|
||||
|
||||
func (this serviceTable) DeleteRange(ctx context.Context, from, to ServiceIndexKey) error {
|
||||
return this.table.GetIndexByID(from.id()).DeleteRange(ctx, from.values(), to.values())
|
||||
}
|
||||
|
||||
func (this serviceTable) doNotImplement() {}
|
||||
|
||||
var _ ServiceTable = serviceTable{}
|
||||
|
||||
func NewServiceTable(db ormtable.Schema) (ServiceTable, error) {
|
||||
table := db.GetTable(&Service{})
|
||||
if table == nil {
|
||||
return nil, ormerrors.TableNotFound.Wrap(string((&Service{}).ProtoReflect().Descriptor().FullName()))
|
||||
}
|
||||
return serviceTable{table}, nil
|
||||
}
|
||||
|
||||
type StateStore interface {
|
||||
AttestationTable() AttestationTable
|
||||
ControllerTable() ControllerTable
|
||||
DelegationTable() DelegationTable
|
||||
ServiceTable() ServiceTable
|
||||
|
||||
doNotImplement()
|
||||
}
|
||||
|
||||
type stateStore struct {
|
||||
attestation AttestationTable
|
||||
controller ControllerTable
|
||||
delegation DelegationTable
|
||||
service ServiceTable
|
||||
}
|
||||
|
||||
func (x stateStore) AttestationTable() AttestationTable {
|
||||
return x.attestation
|
||||
}
|
||||
|
||||
func (x stateStore) ControllerTable() ControllerTable {
|
||||
return x.controller
|
||||
}
|
||||
|
||||
func (x stateStore) DelegationTable() DelegationTable {
|
||||
return x.delegation
|
||||
}
|
||||
|
||||
func (x stateStore) ServiceTable() ServiceTable {
|
||||
return x.service
|
||||
}
|
||||
|
||||
func (stateStore) doNotImplement() {}
|
||||
|
||||
var _ StateStore = stateStore{}
|
||||
|
||||
func NewStateStore(db ormtable.Schema) (StateStore, error) {
|
||||
attestationTable, err := NewAttestationTable(db)
|
||||
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
|
||||
}
|
||||
|
||||
serviceTable, err := NewServiceTable(db)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return stateStore{
|
||||
attestationTable,
|
||||
controllerTable,
|
||||
delegationTable,
|
||||
serviceTable,
|
||||
}, nil
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,193 @@
|
||||
// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
|
||||
// versions:
|
||||
// - protoc-gen-go-grpc v1.3.0
|
||||
// - protoc (unknown)
|
||||
// source: did/v1/tx.proto
|
||||
|
||||
package didv1
|
||||
|
||||
import (
|
||||
context "context"
|
||||
grpc "google.golang.org/grpc"
|
||||
codes "google.golang.org/grpc/codes"
|
||||
status "google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
// This is a compile-time assertion to ensure that this generated file
|
||||
// is compatible with the grpc package it is being compiled against.
|
||||
// Requires gRPC-Go v1.32.0 or later.
|
||||
const _ = grpc.SupportPackageIsVersion7
|
||||
|
||||
const (
|
||||
Msg_UpdateParams_FullMethodName = "/did.v1.Msg/UpdateParams"
|
||||
Msg_InitializeController_FullMethodName = "/did.v1.Msg/InitializeController"
|
||||
Msg_AuthenticateController_FullMethodName = "/did.v1.Msg/AuthenticateController"
|
||||
)
|
||||
|
||||
// MsgClient is the client API for Msg service.
|
||||
//
|
||||
// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
|
||||
type MsgClient interface {
|
||||
// UpdateParams defines a governance operation for updating the parameters.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error)
|
||||
// InitializeController initializes a controller with the given assertions, keyshares, and verifications.
|
||||
InitializeController(ctx context.Context, in *MsgInitializeController, opts ...grpc.CallOption) (*MsgInitializeControllerResponse, error)
|
||||
// AuthenticateController asserts the given controller is the owner of the given address.
|
||||
AuthenticateController(ctx context.Context, in *MsgAuthenticateController, opts ...grpc.CallOption) (*MsgAuthenticateControllerResponse, error)
|
||||
}
|
||||
|
||||
type msgClient struct {
|
||||
cc grpc.ClientConnInterface
|
||||
}
|
||||
|
||||
func NewMsgClient(cc grpc.ClientConnInterface) MsgClient {
|
||||
return &msgClient{cc}
|
||||
}
|
||||
|
||||
func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) {
|
||||
out := new(MsgUpdateParamsResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_UpdateParams_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) InitializeController(ctx context.Context, in *MsgInitializeController, opts ...grpc.CallOption) (*MsgInitializeControllerResponse, error) {
|
||||
out := new(MsgInitializeControllerResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_InitializeController_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (c *msgClient) AuthenticateController(ctx context.Context, in *MsgAuthenticateController, opts ...grpc.CallOption) (*MsgAuthenticateControllerResponse, error) {
|
||||
out := new(MsgAuthenticateControllerResponse)
|
||||
err := c.cc.Invoke(ctx, Msg_AuthenticateController_FullMethodName, in, out, opts...)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return out, nil
|
||||
}
|
||||
|
||||
// MsgServer is the server API for Msg service.
|
||||
// All implementations must embed UnimplementedMsgServer
|
||||
// for forward compatibility
|
||||
type MsgServer interface {
|
||||
// UpdateParams defines a governance operation for updating the parameters.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error)
|
||||
// InitializeController initializes a controller with the given assertions, keyshares, and verifications.
|
||||
InitializeController(context.Context, *MsgInitializeController) (*MsgInitializeControllerResponse, error)
|
||||
// AuthenticateController asserts the given controller is the owner of the given address.
|
||||
AuthenticateController(context.Context, *MsgAuthenticateController) (*MsgAuthenticateControllerResponse, error)
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
// UnimplementedMsgServer must be embedded to have forward compatible implementations.
|
||||
type UnimplementedMsgServer struct {
|
||||
}
|
||||
|
||||
func (UnimplementedMsgServer) UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) InitializeController(context.Context, *MsgInitializeController) (*MsgInitializeControllerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method InitializeController not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) AuthenticateController(context.Context, *MsgAuthenticateController) (*MsgAuthenticateControllerResponse, error) {
|
||||
return nil, status.Errorf(codes.Unimplemented, "method AuthenticateController not implemented")
|
||||
}
|
||||
func (UnimplementedMsgServer) mustEmbedUnimplementedMsgServer() {}
|
||||
|
||||
// UnsafeMsgServer may be embedded to opt out of forward compatibility for this service.
|
||||
// Use of this interface is not recommended, as added methods to MsgServer will
|
||||
// result in compilation errors.
|
||||
type UnsafeMsgServer interface {
|
||||
mustEmbedUnimplementedMsgServer()
|
||||
}
|
||||
|
||||
func RegisterMsgServer(s grpc.ServiceRegistrar, srv MsgServer) {
|
||||
s.RegisterService(&Msg_ServiceDesc, srv)
|
||||
}
|
||||
|
||||
func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgUpdateParams)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).UpdateParams(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_UpdateParams_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_InitializeController_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgInitializeController)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).InitializeController(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_InitializeController_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).InitializeController(ctx, req.(*MsgInitializeController))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
func _Msg_AuthenticateController_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
|
||||
in := new(MsgAuthenticateController)
|
||||
if err := dec(in); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if interceptor == nil {
|
||||
return srv.(MsgServer).AuthenticateController(ctx, in)
|
||||
}
|
||||
info := &grpc.UnaryServerInfo{
|
||||
Server: srv,
|
||||
FullMethod: Msg_AuthenticateController_FullMethodName,
|
||||
}
|
||||
handler := func(ctx context.Context, req interface{}) (interface{}, error) {
|
||||
return srv.(MsgServer).AuthenticateController(ctx, req.(*MsgAuthenticateController))
|
||||
}
|
||||
return interceptor(ctx, in, info, handler)
|
||||
}
|
||||
|
||||
// Msg_ServiceDesc is the grpc.ServiceDesc for Msg service.
|
||||
// It's only intended for direct use with grpc.RegisterService,
|
||||
// and not to be introspected or modified (even as a copy)
|
||||
var Msg_ServiceDesc = grpc.ServiceDesc{
|
||||
ServiceName: "did.v1.Msg",
|
||||
HandlerType: (*MsgServer)(nil),
|
||||
Methods: []grpc.MethodDesc{
|
||||
{
|
||||
MethodName: "UpdateParams",
|
||||
Handler: _Msg_UpdateParams_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "InitializeController",
|
||||
Handler: _Msg_InitializeController_Handler,
|
||||
},
|
||||
{
|
||||
MethodName: "AuthenticateController",
|
||||
Handler: _Msg_AuthenticateController_Handler,
|
||||
},
|
||||
},
|
||||
Streams: []grpc.StreamDesc{},
|
||||
Metadata: "did/v1/tx.proto",
|
||||
}
|
||||
Reference in New Issue
Block a user