feat(orm)!: add orm app wiring proto definitions (#11119)

## Description

This follows up on #11119 and adds app wiring proto definitions for the ORM. These would be used together with an app-wiring `cosmos.app.v1.module` option like so:

```proto
package foo.bar.my_module.v1;

message Module {
    option (cosmos.app.v1.module) = {
      go_import: "github.com/foo/bar/x/my_module"
    };
  
    option (cosmos.orm.v1alpha1.module_schema) = {
      schema_file: {
        id: 1
        path: "foo/bar/my_module/state.proto"
      }
      schema_file: {
        id: 2
        path: "foo/bar/my_module/memory.proto"
        storage_type: cosmos.orm.v1alpha1.STORAGE_TYPE_MEMORY
      }
    };
}
```

This supports various alternative storage types (memory, transient, etc.) which can be scoped to individual file descriptor schemas.

This PR also removes the `references` fields currently in `cosmos.orm.v1alpha`. I do think something like that should be supported, but I don't like having a field unsupported by the tooling when the documentation says otherwise.




---

### Author Checklist

*All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.*

I have...

- [ ] included the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] added `!` to the type prefix if API or client breaking change
- [ ] targeted the correct branch (see [PR Targeting](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#pr-targeting))
- [ ] provided a link to the relevant issue or specification
- [ ] followed the guidelines for [building modules](https://github.com/cosmos/cosmos-sdk/blob/master/docs/building-modules)
- [ ] included the necessary unit and integration [tests](https://github.com/cosmos/cosmos-sdk/blob/master/CONTRIBUTING.md#testing)
- [ ] added a changelog entry to `CHANGELOG.md`
- [ ] included comments for [documenting Go code](https://blog.golang.org/godoc)
- [ ] updated the relevant documentation or specification
- [ ] reviewed "Files changed" and left comments if necessary
- [ ] confirmed all CI checks have passed

### Reviewers Checklist

*All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.*

I have...

- [ ] confirmed the correct [type prefix](https://github.com/commitizen/conventional-commit-types/blob/v3.0.0/index.json) in the PR title
- [ ] confirmed `!` in the type prefix if API or client breaking change
- [ ] confirmed all author checklist items have been addressed 
- [ ] reviewed state machine logic
- [ ] reviewed API design and naming
- [ ] reviewed documentation is accurate
- [ ] reviewed tests and test coverage
- [ ] manually tested (if applicable)
This commit is contained in:
Aaron Craelius 2022-02-24 12:26:59 -05:00 committed by GitHub
parent 7e18e9f1bf
commit 4de7d40010
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 1118 additions and 1265 deletions

View File

@ -3,14 +3,15 @@ package appv1alpha1
import (
fmt "fmt"
io "io"
reflect "reflect"
sync "sync"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
descriptorpb "google.golang.org/protobuf/types/descriptorpb"
io "io"
reflect "reflect"
sync "sync"
)
var _ protoreflect.List = (*_ModuleDescriptor_2_list)(nil)
@ -1802,15 +1803,15 @@ var file_cosmos_app_v1alpha1_module_proto_extTypes = []protoimpl.ExtensionInfo{
ExtendedType: (*descriptorpb.MessageOptions)(nil),
ExtensionType: (*ModuleDescriptor)(nil),
Field: 57193479,
Name: "cosmos.app.v1alpha1.is_module",
Tag: "bytes,57193479,opt,name=is_module",
Name: "cosmos.app.v1alpha1.module",
Tag: "bytes,57193479,opt,name=module",
Filename: "cosmos/app/v1alpha1/module.proto",
},
}
// Extension fields to descriptorpb.MessageOptions.
var (
// is_module indicates that this proto type is a config object for an app module
// module indicates that this proto type is a config object for an app module
// and optionally provides other descriptive information about the module.
// It is recommended that a new module config object and go module is versioned
// for every state machine breaking version of a module. The recommended
@ -1818,8 +1819,8 @@ var (
// package from the API they expose. Ex: the cosmos.group.v1 API would be
// exposed by module configs cosmos.group.module.v1, cosmos.group.module.v2, etc.
//
// optional cosmos.app.v1alpha1.ModuleDescriptor is_module = 57193479;
E_IsModule = &file_cosmos_app_v1alpha1_module_proto_extTypes[0]
// optional cosmos.app.v1alpha1.ModuleDescriptor module = 57193479;
E_Module = &file_cosmos_app_v1alpha1_module_proto_extTypes[0]
)
var File_cosmos_app_v1alpha1_module_proto protoreflect.FileDescriptor
@ -1850,27 +1851,27 @@ var file_cosmos_app_v1alpha1_module_proto_rawDesc = []byte{
0x65, 0x76, 0x69, 0x73, 0x69, 0x6f, 0x6e, 0x22, 0x29, 0x0a, 0x0f, 0x4d, 0x69, 0x67, 0x72, 0x61,
0x74, 0x65, 0x46, 0x72, 0x6f, 0x6d, 0x49, 0x6e, 0x66, 0x6f, 0x12, 0x16, 0x0a, 0x06, 0x6d, 0x6f,
0x64, 0x75, 0x6c, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6d, 0x6f, 0x64, 0x75,
0x6c, 0x65, 0x3a, 0x66, 0x0a, 0x09, 0x69, 0x73, 0x5f, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12,
0x1f, 0x2e, 0x67, 0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75,
0x66, 0x2e, 0x4d, 0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73,
0x18, 0x87, 0xe8, 0xa2, 0x1b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72,
0x52, 0x08, 0x69, 0x73, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0xd6, 0x01, 0x0a, 0x17, 0x63,
0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x76, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72,
0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f,
0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d,
0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61,
0x70, 0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x61, 0x70, 0x70, 0x76,
0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x13,
0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70,
0x68, 0x61, 0x31, 0xca, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x70,
0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x5c, 0x41, 0x70, 0x70, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c,
0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x41, 0x70, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70,
0x68, 0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
0x6c, 0x65, 0x3a, 0x61, 0x0a, 0x06, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x12, 0x1f, 0x2e, 0x67,
0x6f, 0x6f, 0x67, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x75, 0x66, 0x2e, 0x4d,
0x65, 0x73, 0x73, 0x61, 0x67, 0x65, 0x4f, 0x70, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x87, 0xe8,
0xa2, 0x1b, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x25, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e,
0x61, 0x70, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x52, 0x06, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x42, 0xd6, 0x01, 0x0a, 0x17, 0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f,
0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x61, 0x70, 0x70, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61,
0x31, 0x42, 0x0b, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01,
0x5a, 0x40, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61,
0x70, 0x69, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70, 0x70, 0x2f, 0x76, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x61, 0x70, 0x70, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68,
0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x41, 0x58, 0xaa, 0x02, 0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2e, 0x41, 0x70, 0x70, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02,
0x13, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70, 0x70, 0x5c, 0x56, 0x31, 0x61, 0x6c,
0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x1f, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x41, 0x70,
0x70, 0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65,
0x74, 0x61, 0x64, 0x61, 0x74, 0x61, 0xea, 0x02, 0x15, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a,
0x3a, 0x41, 0x70, 0x70, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x62, 0x06,
0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
@ -1895,8 +1896,8 @@ var file_cosmos_app_v1alpha1_module_proto_goTypes = []interface{}{
var file_cosmos_app_v1alpha1_module_proto_depIdxs = []int32{
1, // 0: cosmos.app.v1alpha1.ModuleDescriptor.use_package:type_name -> cosmos.app.v1alpha1.PackageReference
2, // 1: cosmos.app.v1alpha1.ModuleDescriptor.can_migrate_from:type_name -> cosmos.app.v1alpha1.MigrateFromInfo
3, // 2: cosmos.app.v1alpha1.is_module:extendee -> google.protobuf.MessageOptions
0, // 3: cosmos.app.v1alpha1.is_module:type_name -> cosmos.app.v1alpha1.ModuleDescriptor
3, // 2: cosmos.app.v1alpha1.module:extendee -> google.protobuf.MessageOptions
0, // 3: cosmos.app.v1alpha1.module:type_name -> cosmos.app.v1alpha1.ModuleDescriptor
4, // [4:4] is the sub-list for method output_type
4, // [4:4] is the sub-list for method input_type
3, // [3:4] is the sub-list for extension type_name

View File

@ -0,0 +1,509 @@
// Code generated by protoc-gen-go-pulsar. DO NOT EDIT.
package modulev1alpha1
import (
fmt "fmt"
io "io"
reflect "reflect"
sync "sync"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
_ "github.com/cosmos/cosmos-sdk/api/cosmos/app/v1alpha1"
)
var (
md_Module protoreflect.MessageDescriptor
)
func init() {
file_cosmos_orm_module_v1alpha1_module_proto_init()
md_Module = File_cosmos_orm_module_v1alpha1_module_proto.Messages().ByName("Module")
}
var _ protoreflect.Message = (*fastReflection_Module)(nil)
type fastReflection_Module Module
func (x *Module) ProtoReflect() protoreflect.Message {
return (*fastReflection_Module)(x)
}
func (x *Module) slowProtoReflect() protoreflect.Message {
mi := &file_cosmos_orm_module_v1alpha1_module_proto_msgTypes[0]
if protoimpl.UnsafeEnabled && x != nil {
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
if ms.LoadMessageInfo() == nil {
ms.StoreMessageInfo(mi)
}
return ms
}
return mi.MessageOf(x)
}
var _fastReflection_Module_messageType fastReflection_Module_messageType
var _ protoreflect.MessageType = fastReflection_Module_messageType{}
type fastReflection_Module_messageType struct{}
func (x fastReflection_Module_messageType) Zero() protoreflect.Message {
return (*fastReflection_Module)(nil)
}
func (x fastReflection_Module_messageType) New() protoreflect.Message {
return new(fastReflection_Module)
}
func (x fastReflection_Module_messageType) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// Descriptor returns message descriptor, which contains only the protobuf
// type information for the message.
func (x *fastReflection_Module) Descriptor() protoreflect.MessageDescriptor {
return md_Module
}
// Type returns the message type, which encapsulates both Go and protobuf
// type information. If the Go type information is not needed,
// it is recommended that the message descriptor be used instead.
func (x *fastReflection_Module) Type() protoreflect.MessageType {
return _fastReflection_Module_messageType
}
// New returns a newly allocated and mutable empty message.
func (x *fastReflection_Module) New() protoreflect.Message {
return new(fastReflection_Module)
}
// Interface unwraps the message reflection interface and
// returns the underlying ProtoMessage interface.
func (x *fastReflection_Module) Interface() protoreflect.ProtoMessage {
return (*Module)(x)
}
// Range iterates over every populated field in an undefined order,
// calling f for each field descriptor and value encountered.
// Range returns immediately if f returns false.
// While iterating, mutating operations may only be performed
// on the current field descriptor.
func (x *fastReflection_Module) Range(f func(protoreflect.FieldDescriptor, protoreflect.Value) bool) {
}
// Has reports whether a field is populated.
//
// Some fields have the property of nullability where it is possible to
// distinguish between the default value of a field and whether the field
// was explicitly populated with the default value. Singular message fields,
// member fields of a oneof, and proto2 scalar fields are nullable. Such
// fields are populated only if explicitly set.
//
// In other cases (aside from the nullable cases above),
// a proto3 scalar field is populated if it contains a non-zero value, and
// a repeated field is populated if it is non-empty.
func (x *fastReflection_Module) Has(fd protoreflect.FieldDescriptor) bool {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.module.v1alpha1.Module"))
}
panic(fmt.Errorf("message cosmos.orm.module.v1alpha1.Module does not contain field %s", fd.FullName()))
}
}
// Clear clears the field such that a subsequent Has call reports false.
//
// Clearing an extension field clears both the extension type and value
// associated with the given field number.
//
// Clear is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Clear(fd protoreflect.FieldDescriptor) {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.module.v1alpha1.Module"))
}
panic(fmt.Errorf("message cosmos.orm.module.v1alpha1.Module does not contain field %s", fd.FullName()))
}
}
// Get retrieves the value for a field.
//
// For unpopulated scalars, it returns the default value, where
// the default value of a bytes scalar is guaranteed to be a copy.
// For unpopulated composite types, it returns an empty, read-only view
// of the value; to obtain a mutable reference, use Mutable.
func (x *fastReflection_Module) Get(descriptor protoreflect.FieldDescriptor) protoreflect.Value {
switch descriptor.FullName() {
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.module.v1alpha1.Module"))
}
panic(fmt.Errorf("message cosmos.orm.module.v1alpha1.Module does not contain field %s", descriptor.FullName()))
}
}
// Set stores the value for a field.
//
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType.
// When setting a composite type, it is unspecified whether the stored value
// aliases the source's memory in any way. If the composite value is an
// empty, read-only value, then it panics.
//
// Set is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Set(fd protoreflect.FieldDescriptor, value protoreflect.Value) {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.module.v1alpha1.Module"))
}
panic(fmt.Errorf("message cosmos.orm.module.v1alpha1.Module does not contain field %s", fd.FullName()))
}
}
// Mutable returns a mutable reference to a composite type.
//
// If the field is unpopulated, it may allocate a composite value.
// For a field belonging to a oneof, it implicitly clears any other field
// that may be currently set within the same oneof.
// For extension fields, it implicitly stores the provided ExtensionType
// if not already stored.
// It panics if the field does not contain a composite type.
//
// Mutable is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) Mutable(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.module.v1alpha1.Module"))
}
panic(fmt.Errorf("message cosmos.orm.module.v1alpha1.Module does not contain field %s", fd.FullName()))
}
}
// NewField returns a new value that is assignable to the field
// for the given descriptor. For scalars, this returns the default value.
// For lists, maps, and messages, this returns a new, empty, mutable value.
func (x *fastReflection_Module) NewField(fd protoreflect.FieldDescriptor) protoreflect.Value {
switch fd.FullName() {
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.module.v1alpha1.Module"))
}
panic(fmt.Errorf("message cosmos.orm.module.v1alpha1.Module does not contain field %s", fd.FullName()))
}
}
// WhichOneof reports which field within the oneof is populated,
// returning nil if none are populated.
// It panics if the oneof descriptor does not belong to this message.
func (x *fastReflection_Module) WhichOneof(d protoreflect.OneofDescriptor) protoreflect.FieldDescriptor {
switch d.FullName() {
default:
panic(fmt.Errorf("%s is not a oneof field in cosmos.orm.module.v1alpha1.Module", d.FullName()))
}
panic("unreachable")
}
// GetUnknown retrieves the entire list of unknown fields.
// The caller may only mutate the contents of the RawFields
// if the mutated bytes are stored back into the message with SetUnknown.
func (x *fastReflection_Module) GetUnknown() protoreflect.RawFields {
return x.unknownFields
}
// SetUnknown stores an entire list of unknown fields.
// The raw fields must be syntactically valid according to the wire format.
// An implementation may panic if this is not the case.
// Once stored, the caller must not mutate the content of the RawFields.
// An empty RawFields may be passed to clear the fields.
//
// SetUnknown is a mutating operation and unsafe for concurrent use.
func (x *fastReflection_Module) SetUnknown(fields protoreflect.RawFields) {
x.unknownFields = fields
}
// IsValid reports whether the message is valid.
//
// An invalid message is an empty, read-only value.
//
// An invalid message often corresponds to a nil pointer of the concrete
// message type, but the details are implementation dependent.
// Validity is not part of the protobuf data model, and may not
// be preserved in marshaling or other operations.
func (x *fastReflection_Module) IsValid() bool {
return x != nil
}
// ProtoMethods returns optional fastReflectionFeature-path implementations of various operations.
// This method may return nil.
//
// The returned methods type is identical to
// "google.golang.org/protobuf/runtime/protoiface".Methods.
// Consult the protoiface package documentation for details.
func (x *fastReflection_Module) ProtoMethods() *protoiface.Methods {
size := func(input protoiface.SizeInput) protoiface.SizeOutput {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: 0,
}
}
options := runtime.SizeInputToOptions(input)
_ = options
var n int
var l int
_ = l
if x.unknownFields != nil {
n += len(x.unknownFields)
}
return protoiface.SizeOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Size: n,
}
}
marshal := func(input protoiface.MarshalInput) (protoiface.MarshalOutput, error) {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
options := runtime.MarshalInputToOptions(input)
_ = options
size := options.Size(x)
dAtA := make([]byte, size)
i := len(dAtA)
_ = i
var l int
_ = l
if x.unknownFields != nil {
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if input.Buf != nil {
input.Buf = append(input.Buf, dAtA...)
} else {
input.Buf = dAtA
}
return protoiface.MarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Buf: input.Buf,
}, nil
}
unmarshal := func(input protoiface.UnmarshalInput) (protoiface.UnmarshalOutput, error) {
x := input.Message.Interface().(*Module)
if x == nil {
return protoiface.UnmarshalOutput{
NoUnkeyedLiterals: input.NoUnkeyedLiterals,
Flags: input.Flags,
}, nil
}
options := runtime.UnmarshalInputToOptions(input)
_ = options
dAtA := input.Buf
l := len(dAtA)
iNdEx := 0
for iNdEx < l {
preIndex := iNdEx
var wire uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
wire |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
fieldNum := int32(wire >> 3)
wireType := int(wire & 0x7)
if wireType == 4 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: wiretype end group for non-group")
}
if fieldNum <= 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: Module: illegal tag %d (wire type %d)", fieldNum, wire)
}
switch fieldNum {
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
if err != nil {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, err
}
if (skippy < 0) || (iNdEx+skippy) < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if (iNdEx + skippy) > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
if !options.DiscardUnknown {
x.unknownFields = append(x.unknownFields, dAtA[iNdEx:iNdEx+skippy]...)
}
iNdEx += skippy
}
}
if iNdEx > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, nil
}
return &protoiface.Methods{
NoUnkeyedLiterals: struct{}{},
Flags: protoiface.SupportMarshalDeterministic | protoiface.SupportUnmarshalDiscardUnknown,
Size: size,
Marshal: marshal,
Unmarshal: unmarshal,
Merge: nil,
CheckInitialized: nil,
}
}
// Code generated by protoc-gen-go. DO NOT EDIT.
// versions:
// protoc-gen-go v1.27.0
// protoc (unknown)
// source: cosmos/orm/module/v1alpha1/module.proto
const (
// Verify that this generated code is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
// Verify that runtime/protoimpl is sufficiently up-to-date.
_ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
)
// Module defines the ORM module which adds providers to the app container for
// module-scoped DB's. In the future it may provide gRPC services for interacting
// with ORM data.
type Module struct {
state protoimpl.MessageState
sizeCache protoimpl.SizeCache
unknownFields protoimpl.UnknownFields
}
func (x *Module) Reset() {
*x = Module{}
if protoimpl.UnsafeEnabled {
mi := &file_cosmos_orm_module_v1alpha1_module_proto_msgTypes[0]
ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
ms.StoreMessageInfo(mi)
}
}
func (x *Module) String() string {
return protoimpl.X.MessageStringOf(x)
}
func (*Module) ProtoMessage() {}
// Deprecated: Use Module.ProtoReflect.Descriptor instead.
func (*Module) Descriptor() ([]byte, []int) {
return file_cosmos_orm_module_v1alpha1_module_proto_rawDescGZIP(), []int{0}
}
var File_cosmos_orm_module_v1alpha1_module_proto protoreflect.FileDescriptor
var file_cosmos_orm_module_v1alpha1_module_proto_rawDesc = []byte{
0x0a, 0x27, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x72, 0x6d, 0x2f, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x1a, 0x63, 0x6f, 0x73, 0x6d, 0x6f,
0x73, 0x2e, 0x6f, 0x72, 0x6d, 0x2e, 0x6d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61,
0x6c, 0x70, 0x68, 0x61, 0x31, 0x1a, 0x20, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x61, 0x70,
0x70, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x32, 0x0a, 0x06, 0x4d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x3a, 0x28, 0xba, 0xc0, 0x96, 0xda, 0x01, 0x22, 0x0a, 0x20, 0x67, 0x69, 0x74, 0x68, 0x75,
0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x63, 0x6f, 0x73,
0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x6f, 0x72, 0x6d, 0x42, 0x84, 0x02, 0x0a, 0x1e,
0x63, 0x6f, 0x6d, 0x2e, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x6f, 0x72, 0x6d, 0x2e, 0x6d,
0x6f, 0x64, 0x75, 0x6c, 0x65, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x42, 0x0b,
0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x50, 0x72, 0x6f, 0x74, 0x6f, 0x50, 0x01, 0x5a, 0x4a, 0x67,
0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73,
0x2f, 0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2d, 0x73, 0x64, 0x6b, 0x2f, 0x61, 0x70, 0x69, 0x2f,
0x63, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2f, 0x6f, 0x72, 0x6d, 0x2f, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x2f, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x3b, 0x6d, 0x6f, 0x64, 0x75, 0x6c,
0x65, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xa2, 0x02, 0x03, 0x43, 0x4f, 0x4d, 0xaa,
0x02, 0x1a, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x2e, 0x4f, 0x72, 0x6d, 0x2e, 0x4d, 0x6f, 0x64,
0x75, 0x6c, 0x65, 0x2e, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xca, 0x02, 0x1a, 0x43,
0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x5c, 0x4f, 0x72, 0x6d, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65,
0x5c, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0xe2, 0x02, 0x26, 0x43, 0x6f, 0x73, 0x6d,
0x6f, 0x73, 0x5c, 0x4f, 0x72, 0x6d, 0x5c, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x5c, 0x56, 0x31,
0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x5c, 0x47, 0x50, 0x42, 0x4d, 0x65, 0x74, 0x61, 0x64, 0x61,
0x74, 0x61, 0xea, 0x02, 0x1d, 0x43, 0x6f, 0x73, 0x6d, 0x6f, 0x73, 0x3a, 0x3a, 0x4f, 0x72, 0x6d,
0x3a, 0x3a, 0x4d, 0x6f, 0x64, 0x75, 0x6c, 0x65, 0x3a, 0x3a, 0x56, 0x31, 0x61, 0x6c, 0x70, 0x68,
0x61, 0x31, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
}
var (
file_cosmos_orm_module_v1alpha1_module_proto_rawDescOnce sync.Once
file_cosmos_orm_module_v1alpha1_module_proto_rawDescData = file_cosmos_orm_module_v1alpha1_module_proto_rawDesc
)
func file_cosmos_orm_module_v1alpha1_module_proto_rawDescGZIP() []byte {
file_cosmos_orm_module_v1alpha1_module_proto_rawDescOnce.Do(func() {
file_cosmos_orm_module_v1alpha1_module_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosmos_orm_module_v1alpha1_module_proto_rawDescData)
})
return file_cosmos_orm_module_v1alpha1_module_proto_rawDescData
}
var file_cosmos_orm_module_v1alpha1_module_proto_msgTypes = make([]protoimpl.MessageInfo, 1)
var file_cosmos_orm_module_v1alpha1_module_proto_goTypes = []interface{}{
(*Module)(nil), // 0: cosmos.orm.module.v1alpha1.Module
}
var file_cosmos_orm_module_v1alpha1_module_proto_depIdxs = []int32{
0, // [0:0] is the sub-list for method output_type
0, // [0:0] is the sub-list for method input_type
0, // [0:0] is the sub-list for extension type_name
0, // [0:0] is the sub-list for extension extendee
0, // [0:0] is the sub-list for field type_name
}
func init() { file_cosmos_orm_module_v1alpha1_module_proto_init() }
func file_cosmos_orm_module_v1alpha1_module_proto_init() {
if File_cosmos_orm_module_v1alpha1_module_proto != nil {
return
}
if !protoimpl.UnsafeEnabled {
file_cosmos_orm_module_v1alpha1_module_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
switch v := v.(*Module); i {
case 0:
return &v.state
case 1:
return &v.sizeCache
case 2:
return &v.unknownFields
default:
return nil
}
}
}
type x struct{}
out := protoimpl.TypeBuilder{
File: protoimpl.DescBuilder{
GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
RawDescriptor: file_cosmos_orm_module_v1alpha1_module_proto_rawDesc,
NumEnums: 0,
NumMessages: 1,
NumExtensions: 0,
NumServices: 0,
},
GoTypes: file_cosmos_orm_module_v1alpha1_module_proto_goTypes,
DependencyIndexes: file_cosmos_orm_module_v1alpha1_module_proto_depIdxs,
MessageInfos: file_cosmos_orm_module_v1alpha1_module_proto_msgTypes,
}.Build()
File_cosmos_orm_module_v1alpha1_module_proto = out.File
file_cosmos_orm_module_v1alpha1_module_proto_rawDesc = nil
file_cosmos_orm_module_v1alpha1_module_proto_goTypes = nil
file_cosmos_orm_module_v1alpha1_module_proto_depIdxs = nil
}

View File

@ -3,14 +3,15 @@ package ormv1alpha1
import (
fmt "fmt"
io "io"
reflect "reflect"
sync "sync"
runtime "github.com/cosmos/cosmos-proto/runtime"
protoreflect "google.golang.org/protobuf/reflect/protoreflect"
protoiface "google.golang.org/protobuf/runtime/protoiface"
protoimpl "google.golang.org/protobuf/runtime/protoimpl"
descriptorpb "google.golang.org/protobuf/types/descriptorpb"
io "io"
reflect "reflect"
sync "sync"
)
var _ protoreflect.List = (*_TableDescriptor_2_list)(nil)
@ -638,7 +639,6 @@ var (
md_PrimaryKeyDescriptor protoreflect.MessageDescriptor
fd_PrimaryKeyDescriptor_fields protoreflect.FieldDescriptor
fd_PrimaryKeyDescriptor_auto_increment protoreflect.FieldDescriptor
fd_PrimaryKeyDescriptor_references protoreflect.FieldDescriptor
)
func init() {
@ -646,7 +646,6 @@ func init() {
md_PrimaryKeyDescriptor = File_cosmos_orm_v1alpha1_orm_proto.Messages().ByName("PrimaryKeyDescriptor")
fd_PrimaryKeyDescriptor_fields = md_PrimaryKeyDescriptor.Fields().ByName("fields")
fd_PrimaryKeyDescriptor_auto_increment = md_PrimaryKeyDescriptor.Fields().ByName("auto_increment")
fd_PrimaryKeyDescriptor_references = md_PrimaryKeyDescriptor.Fields().ByName("references")
}
var _ protoreflect.Message = (*fastReflection_PrimaryKeyDescriptor)(nil)
@ -726,12 +725,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) Range(f func(protoreflect.FieldDes
return
}
}
if x.References != "" {
value := protoreflect.ValueOfString(x.References)
if !f(fd_PrimaryKeyDescriptor_references, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -751,8 +744,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) Has(fd protoreflect.FieldDescripto
return x.Fields != ""
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.auto_increment":
return x.AutoIncrement != false
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.references":
return x.References != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.PrimaryKeyDescriptor"))
@ -773,8 +764,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) Clear(fd protoreflect.FieldDescrip
x.Fields = ""
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.auto_increment":
x.AutoIncrement = false
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.references":
x.References = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.PrimaryKeyDescriptor"))
@ -797,9 +786,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) Get(descriptor protoreflect.FieldD
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.auto_increment":
value := x.AutoIncrement
return protoreflect.ValueOfBool(value)
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.references":
value := x.References
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.PrimaryKeyDescriptor"))
@ -824,8 +810,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) Set(fd protoreflect.FieldDescripto
x.Fields = value.Interface().(string)
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.auto_increment":
x.AutoIncrement = value.Bool()
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.references":
x.References = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.PrimaryKeyDescriptor"))
@ -850,8 +834,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) Mutable(fd protoreflect.FieldDescr
panic(fmt.Errorf("field fields of message cosmos.orm.v1alpha1.PrimaryKeyDescriptor is not mutable"))
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.auto_increment":
panic(fmt.Errorf("field auto_increment of message cosmos.orm.v1alpha1.PrimaryKeyDescriptor is not mutable"))
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.references":
panic(fmt.Errorf("field references of message cosmos.orm.v1alpha1.PrimaryKeyDescriptor is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.PrimaryKeyDescriptor"))
@ -869,8 +851,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) NewField(fd protoreflect.FieldDesc
return protoreflect.ValueOfString("")
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.auto_increment":
return protoreflect.ValueOfBool(false)
case "cosmos.orm.v1alpha1.PrimaryKeyDescriptor.references":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.PrimaryKeyDescriptor"))
@ -947,10 +927,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) ProtoMethods() *protoiface.Methods
if x.AutoIncrement {
n += 2
}
l = len(x.References)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -980,13 +956,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) ProtoMethods() *protoiface.Methods
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.References) > 0 {
i -= len(x.References)
copy(dAtA[i:], x.References)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.References)))
i--
dAtA[i] = 0x1a
}
if x.AutoIncrement {
i--
if x.AutoIncrement {
@ -1105,38 +1074,6 @@ func (x *fastReflection_PrimaryKeyDescriptor) ProtoMethods() *protoiface.Methods
}
}
x.AutoIncrement = bool(v != 0)
case 3:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field References", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.References = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -1173,11 +1110,10 @@ func (x *fastReflection_PrimaryKeyDescriptor) ProtoMethods() *protoiface.Methods
}
var (
md_SecondaryIndexDescriptor protoreflect.MessageDescriptor
fd_SecondaryIndexDescriptor_fields protoreflect.FieldDescriptor
fd_SecondaryIndexDescriptor_id protoreflect.FieldDescriptor
fd_SecondaryIndexDescriptor_unique protoreflect.FieldDescriptor
fd_SecondaryIndexDescriptor_references protoreflect.FieldDescriptor
md_SecondaryIndexDescriptor protoreflect.MessageDescriptor
fd_SecondaryIndexDescriptor_fields protoreflect.FieldDescriptor
fd_SecondaryIndexDescriptor_id protoreflect.FieldDescriptor
fd_SecondaryIndexDescriptor_unique protoreflect.FieldDescriptor
)
func init() {
@ -1186,7 +1122,6 @@ func init() {
fd_SecondaryIndexDescriptor_fields = md_SecondaryIndexDescriptor.Fields().ByName("fields")
fd_SecondaryIndexDescriptor_id = md_SecondaryIndexDescriptor.Fields().ByName("id")
fd_SecondaryIndexDescriptor_unique = md_SecondaryIndexDescriptor.Fields().ByName("unique")
fd_SecondaryIndexDescriptor_references = md_SecondaryIndexDescriptor.Fields().ByName("references")
}
var _ protoreflect.Message = (*fastReflection_SecondaryIndexDescriptor)(nil)
@ -1272,12 +1207,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) Range(f func(protoreflect.Fiel
return
}
}
if x.References != "" {
value := protoreflect.ValueOfString(x.References)
if !f(fd_SecondaryIndexDescriptor_references, value) {
return
}
}
}
// Has reports whether a field is populated.
@ -1299,8 +1228,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) Has(fd protoreflect.FieldDescr
return x.Id != uint32(0)
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.unique":
return x.Unique != false
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.references":
return x.References != ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.SecondaryIndexDescriptor"))
@ -1323,8 +1250,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) Clear(fd protoreflect.FieldDes
x.Id = uint32(0)
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.unique":
x.Unique = false
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.references":
x.References = ""
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.SecondaryIndexDescriptor"))
@ -1350,9 +1275,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) Get(descriptor protoreflect.Fi
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.unique":
value := x.Unique
return protoreflect.ValueOfBool(value)
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.references":
value := x.References
return protoreflect.ValueOfString(value)
default:
if descriptor.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.SecondaryIndexDescriptor"))
@ -1379,8 +1301,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) Set(fd protoreflect.FieldDescr
x.Id = uint32(value.Uint())
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.unique":
x.Unique = value.Bool()
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.references":
x.References = value.Interface().(string)
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.SecondaryIndexDescriptor"))
@ -1407,8 +1327,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) Mutable(fd protoreflect.FieldD
panic(fmt.Errorf("field id of message cosmos.orm.v1alpha1.SecondaryIndexDescriptor is not mutable"))
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.unique":
panic(fmt.Errorf("field unique of message cosmos.orm.v1alpha1.SecondaryIndexDescriptor is not mutable"))
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.references":
panic(fmt.Errorf("field references of message cosmos.orm.v1alpha1.SecondaryIndexDescriptor is not mutable"))
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.SecondaryIndexDescriptor"))
@ -1428,8 +1346,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) NewField(fd protoreflect.Field
return protoreflect.ValueOfUint32(uint32(0))
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.unique":
return protoreflect.ValueOfBool(false)
case "cosmos.orm.v1alpha1.SecondaryIndexDescriptor.references":
return protoreflect.ValueOfString("")
default:
if fd.IsExtension() {
panic(fmt.Errorf("proto3 declared messages do not support extensions: cosmos.orm.v1alpha1.SecondaryIndexDescriptor"))
@ -1509,10 +1425,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) ProtoMethods() *protoiface.Met
if x.Unique {
n += 2
}
l = len(x.References)
if l > 0 {
n += 1 + l + runtime.Sov(uint64(l))
}
if x.unknownFields != nil {
n += len(x.unknownFields)
}
@ -1542,13 +1454,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) ProtoMethods() *protoiface.Met
i -= len(x.unknownFields)
copy(dAtA[i:], x.unknownFields)
}
if len(x.References) > 0 {
i -= len(x.References)
copy(dAtA[i:], x.References)
i = runtime.EncodeVarint(dAtA, i, uint64(len(x.References)))
i--
dAtA[i] = 0x22
}
if x.Unique {
i--
if x.Unique {
@ -1691,38 +1596,6 @@ func (x *fastReflection_SecondaryIndexDescriptor) ProtoMethods() *protoiface.Met
}
}
x.Unique = bool(v != 0)
case 4:
if wireType != 2 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field References", wireType)
}
var stringLen uint64
for shift := uint(0); ; shift += 7 {
if shift >= 64 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow
}
if iNdEx >= l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
b := dAtA[iNdEx]
iNdEx++
stringLen |= uint64(b&0x7F) << shift
if b < 0x80 {
break
}
}
intStringLen := int(stringLen)
if intStringLen < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
postIndex := iNdEx + intStringLen
if postIndex < 0 {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrInvalidLength
}
if postIndex > l {
return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF
}
x.References = string(dAtA[iNdEx:postIndex])
iNdEx = postIndex
default:
iNdEx = preIndex
skippy, err := runtime.Skip(dAtA[iNdEx:])
@ -2276,11 +2149,6 @@ type PrimaryKeyDescriptor struct {
// auto-incrementing integer. If this is set to true fields must only
// contain one field of that is of type uint64.
AutoIncrement bool `protobuf:"varint,2,opt,name=auto_increment,json=autoIncrement,proto3" json:"auto_increment,omitempty"`
// references specifies that this primary key references the primary key
// of another table. See the documentation for the SecondaryIndexDescriptor.references
// field for more details. An additional constraint placed on primary keys
// which reference another table is that those references cannot be circular.
References string `protobuf:"bytes,3,opt,name=references,proto3" json:"references,omitempty"`
}
func (x *PrimaryKeyDescriptor) Reset() {
@ -2317,13 +2185,6 @@ func (x *PrimaryKeyDescriptor) GetAutoIncrement() bool {
return false
}
func (x *PrimaryKeyDescriptor) GetReferences() string {
if x != nil {
return x.References
}
return ""
}
// PrimaryKeyDescriptor describes a table secondary index.
type SecondaryIndexDescriptor struct {
state protoimpl.MessageState
@ -2346,15 +2207,6 @@ type SecondaryIndexDescriptor struct {
Id uint32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"`
// unique specifies that this an unique index.
Unique bool `protobuf:"varint,3,opt,name=unique,proto3" json:"unique,omitempty"`
// references specifies that this index references another table defined in the same
// proto file. Currently references are not support to tables with composite
// primary keys, therefore fields must reference one field and its type must
// be the same type as the primary key field of the referenced table.
// References to tables in defined by different proto files are not supported
// to avoid tight coupling of dependencies. Beyond validating that the reference
// is valid key constraints are currently not enforced, but references should
// be used by clients to perform automatic joins.
References string `protobuf:"bytes,4,opt,name=references,proto3" json:"references,omitempty"`
}
func (x *SecondaryIndexDescriptor) Reset() {
@ -2398,13 +2250,6 @@ func (x *SecondaryIndexDescriptor) GetUnique() bool {
return false
}
func (x *SecondaryIndexDescriptor) GetReferences() string {
if x != nil {
return x.References
}
return ""
}
// TableDescriptor describes an ORM singleton table which has at most one instance.
type SingletonDescriptor struct {
state protoimpl.MessageState
@ -2496,22 +2341,18 @@ var file_cosmos_orm_v1alpha1_orm_proto_rawDesc = []byte{
0x72, 0x6d, 0x2e, 0x76, 0x31, 0x61, 0x6c, 0x70, 0x68, 0x61, 0x31, 0x2e, 0x53, 0x65, 0x63, 0x6f,
0x6e, 0x64, 0x61, 0x72, 0x79, 0x49, 0x6e, 0x64, 0x65, 0x78, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69,
0x70, 0x74, 0x6f, 0x72, 0x52, 0x05, 0x69, 0x6e, 0x64, 0x65, 0x78, 0x12, 0x0e, 0x0a, 0x02, 0x69,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x75, 0x0a, 0x14, 0x50,
0x64, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x22, 0x55, 0x0a, 0x14, 0x50,
0x72, 0x69, 0x6d, 0x61, 0x72, 0x79, 0x4b, 0x65, 0x79, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70,
0x74, 0x6f, 0x72, 0x12, 0x16, 0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20,
0x01, 0x28, 0x09, 0x52, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x25, 0x0a, 0x0e, 0x61,
0x75, 0x74, 0x6f, 0x5f, 0x69, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65, 0x6e, 0x74, 0x18, 0x02, 0x20,
0x01, 0x28, 0x08, 0x52, 0x0d, 0x61, 0x75, 0x74, 0x6f, 0x49, 0x6e, 0x63, 0x72, 0x65, 0x6d, 0x65,
0x6e, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73,
0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63,
0x65, 0x73, 0x22, 0x7a, 0x0a, 0x18, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x49,
0x6e, 0x74, 0x22, 0x5a, 0x0a, 0x18, 0x53, 0x65, 0x63, 0x6f, 0x6e, 0x64, 0x61, 0x72, 0x79, 0x49,
0x6e, 0x64, 0x65, 0x78, 0x44, 0x65, 0x73, 0x63, 0x72, 0x69, 0x70, 0x74, 0x6f, 0x72, 0x12, 0x16,
0x0a, 0x06, 0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06,
0x66, 0x69, 0x65, 0x6c, 0x64, 0x73, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x02, 0x20, 0x01,
0x28, 0x0d, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65,
0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x12, 0x1e,
0x0a, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01,
0x28, 0x09, 0x52, 0x0a, 0x72, 0x65, 0x66, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x65, 0x73, 0x22, 0x25,
0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x06, 0x75, 0x6e, 0x69, 0x71, 0x75, 0x65, 0x22, 0x25,
0x0a, 0x13, 0x53, 0x69, 0x6e, 0x67, 0x6c, 0x65, 0x74, 0x6f, 0x6e, 0x44, 0x65, 0x73, 0x63, 0x72,
0x69, 0x70, 0x74, 0x6f, 0x72, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28,
0x0d, 0x52, 0x02, 0x69, 0x64, 0x3a, 0x5e, 0x0a, 0x05, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x12, 0x1f,

File diff suppressed because it is too large Load Diff

View File

@ -6,7 +6,7 @@ import "cosmos/app/v1alpha1/module.proto";
// Module is the module config object for the cosmos.app v1 app module.
message Module {
option (cosmos.app.v1alpha1.is_module) = {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/app"
use_package: {
name: "cosmos.app.v1alpha1"

View File

@ -5,14 +5,14 @@ package cosmos.app.v1alpha1;
import "google/protobuf/descriptor.proto";
extend google.protobuf.MessageOptions {
// is_module indicates that this proto type is a config object for an app module
// module indicates that this proto type is a config object for an app module
// and optionally provides other descriptive information about the module.
// It is recommended that a new module config object and go module is versioned
// for every state machine breaking version of a module. The recommended
// pattern for doing this is to put module config objects in a separate proto
// package from the API they expose. Ex: the cosmos.group.v1 API would be
// exposed by module configs cosmos.group.module.v1, cosmos.group.module.v2, etc.
ModuleDescriptor is_module = 57193479;
ModuleDescriptor module = 57193479;
}
// ModuleDescriptor describes an app module.

View File

@ -0,0 +1,14 @@
syntax = "proto3";
package cosmos.orm.module.v1alpha1;
import "cosmos/app/v1alpha1/module.proto";
// Module defines the ORM module which adds providers to the app container for
// module-scoped DB's. In the future it may provide gRPC services for interacting
// with ORM data.
message Module {
option (cosmos.app.v1alpha1.module) = {
go_import: "github.com/cosmos/cosmos-sdk/orm"
};
}

View File

@ -72,12 +72,6 @@ message PrimaryKeyDescriptor {
// auto-incrementing integer. If this is set to true fields must only
// contain one field of that is of type uint64.
bool auto_increment = 2;
// references specifies that this primary key references the primary key
// of another table. See the documentation for the SecondaryIndexDescriptor.references
// field for more details. An additional constraint placed on primary keys
// which reference another table is that those references cannot be circular.
string references = 3;
}
// PrimaryKeyDescriptor describes a table secondary index.
@ -101,16 +95,6 @@ message SecondaryIndexDescriptor {
// unique specifies that this an unique index.
bool unique = 3;
// references specifies that this index references another table defined in the same
// proto file. Currently references are not support to tables with composite
// primary keys, therefore fields must reference one field and its type must
// be the same type as the primary key field of the referenced table.
// References to tables in defined by different proto files are not supported
// to avoid tight coupling of dependencies. Beyond validating that the reference
// is valid key constraints are currently not enforced, but references should
// be used by clients to perform automatic joins.
string references = 4;
}
// TableDescriptor describes an ORM singleton table which has at most one instance.

View File

@ -4,31 +4,17 @@ package cosmos.orm.v1alpha1;
import "google/protobuf/descriptor.proto";
// SchemaDescriptor describes an ORM schema that contains all the information
// needed for a dynamic client to decode the stored data.
message SchemaDescriptor {
extend google.protobuf.MessageOptions {
// module_schema is used to define the ORM schema for an app module.
// All module config messages that use module_schema must also declare
// themselves as app module config messages using the cosmos.app.v1.is_module
// option.
ModuleSchemaDescriptor module_schema = 104503792;
}
// files is the set of all FileDescriptorProto's needed to decode the stored data.
// A schema imposes the constraint that every file and every table within that
// schema have at most one instance in the store.
google.protobuf.FileDescriptorSet files = 1;
// modules is the set of modules in the schema.
repeated ModuleEntry modules = 2;
// ModuleEntry describes a single module's schema.
message ModuleEntry {
// name is the name of the module. In the multi-store model this name is
// used to locate the module's store.
string name = 1;
// prefix is an optional prefix that precedes all keys in this module's
// store.
bytes prefix = 2;
// files describes the schema files used in this module.
repeated FileEntry files = 3;
}
// ModuleSchemaDescriptor describe's a module's ORM schema.
message ModuleSchemaDescriptor {
repeated FileEntry schema_file = 1;
// FileEntry describes an ORM file used in a module.
message FileEntry {
@ -36,8 +22,55 @@ message SchemaDescriptor {
// table keys specified in the file's tables.
uint32 id = 1;
// file_name is the name of a file in the FileDescriptor set that contains
// table definitions.
string file_name = 2;
// proto_file_name is the name of a file .proto in that contains
// table definitions. The .proto file must be in a package that the
// module has referenced using cosmos.app.v1.ModuleDescriptor.use_package.
string proto_file_name = 2;
// storage_type optionally indicates the type of storage this file's
// tables should used. If it is left unspecified, the default KV-storage
// of the app will be used.
StorageType storage_type = 3;
}
// prefix is an optional prefix that precedes all keys in this module's
// store.
bytes prefix = 2;
}
// StorageType
enum StorageType {
// STORAGE_TYPE_DEFAULT_UNSPECIFIED indicates the persistent
// KV-storage where primary key entries are stored in merkle-tree
// backed commitment storage and indexes and seqs are stored in
// fast index storage. Note that the Cosmos SDK before store/v2
// does not support this.
STORAGE_TYPE_DEFAULT_UNSPECIFIED = 0;
// STORAGE_TYPE_MEMORY indicates in-memory storage that will be
// reloaded every time an app restarts. Tables with this type of storage
// will by default be ignored when importing and exporting a module's
// state from JSON.
STORAGE_TYPE_MEMORY = 1;
// STORAGE_TYPE_TRANSIENT indicates transient storage that is reset
// at the end of every block. Tables with this type of storage
// will by default be ignored when importing and exporting a module's
// state from JSON.
STORAGE_TYPE_TRANSIENT = 2;
// STORAGE_TYPE_INDEX indicates persistent storage which is not backed
// by a merkle-tree and won't affect the app hash. Note that the Cosmos SDK
// before store/v2 does not support this.
STORAGE_TYPE_INDEX = 3;
// STORAGE_TYPE_INDEX indicates persistent storage which is backed by
// a merkle-tree. With this type of storage, both primary and index keys
// will affect the app hash and this is generally less efficient
// than using STORAGE_TYPE_DEFAULT_UNSPECIFIED which separates index
// keys into index storage. Note that modules built with the
// Cosmos SDK before store/v2 must specify STORAGE_TYPE_COMMITMENT
// instead of STORAGE_TYPE_DEFAULT_UNSPECIFIED or STORAGE_TYPE_INDEX
// because this is the only type of persistent storage available.
STORAGE_TYPE_COMMITMENT = 4;
}