chore: gofumpt (#11839)
* fumpt using main not master... * be more descriptive * fumpt * fix nits Co-authored-by: Julien Robert <julien@rbrt.fr>
This commit is contained in:
co-authored by
Julien Robert
parent
bc2d553f77
commit
55054282d2
@@ -51,7 +51,6 @@ type moduleDB struct {
|
||||
|
||||
// ModuleDBOptions are options for constructing a ModuleDB.
|
||||
type ModuleDBOptions struct {
|
||||
|
||||
// TypeResolver is an optional type resolver to be used when unmarshaling
|
||||
// protobuf messages. If it is nil, protoregistry.GlobalTypes will be used.
|
||||
TypeResolver ormtable.TypeResolver
|
||||
|
||||
@@ -355,13 +355,14 @@ func TestGetBackendResolver(t *testing.T) {
|
||||
})
|
||||
assert.ErrorContains(t, err, "unsupported")
|
||||
|
||||
_, err = ormdb.NewModuleDB(&ormv1alpha1.ModuleSchemaDescriptor{SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{
|
||||
{
|
||||
Id: 1,
|
||||
ProtoFileName: testpb.File_testpb_bank_proto.Path(),
|
||||
StorageType: ormv1alpha1.StorageType_STORAGE_TYPE_MEMORY,
|
||||
_, err = ormdb.NewModuleDB(&ormv1alpha1.ModuleSchemaDescriptor{
|
||||
SchemaFile: []*ormv1alpha1.ModuleSchemaDescriptor_FileEntry{
|
||||
{
|
||||
Id: 1,
|
||||
ProtoFileName: testpb.File_testpb_bank_proto.Path(),
|
||||
StorageType: ormv1alpha1.StorageType_STORAGE_TYPE_MEMORY,
|
||||
},
|
||||
},
|
||||
},
|
||||
}, ormdb.ModuleDBOptions{
|
||||
GetBackendResolver: getResolver,
|
||||
})
|
||||
|
||||
@@ -50,7 +50,6 @@ type Backend interface {
|
||||
// If the index store is not defined, the commitment store will be
|
||||
// used for all operations.
|
||||
type ReadBackendOptions struct {
|
||||
|
||||
// CommitmentStoreReader is a reader for the commitment store.
|
||||
CommitmentStoreReader kv.ReadonlyStore
|
||||
|
||||
@@ -135,7 +134,6 @@ func (c backend) IndexStore() kv.Store {
|
||||
// If the index store is not defined, the commitment store will be
|
||||
// used for all operations.
|
||||
type BackendOptions struct {
|
||||
|
||||
// CommitmentStore is the commitment store.
|
||||
CommitmentStore kv.Store
|
||||
|
||||
|
||||
@@ -75,7 +75,6 @@ func flushBuf(store kv.Store, writes []*batchWriterEntry) error {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
@@ -219,7 +219,7 @@ func getBalance(store kv.Store, address, denom string) (*testpb.Balance, error)
|
||||
return nil, fmt.Errorf("not found")
|
||||
}
|
||||
|
||||
var balance = testpb.Balance{}
|
||||
balance := testpb.Balance{}
|
||||
err = proto.Unmarshal(bz, &balance)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
// ValidateHooks defines an interface for a table hooks which can intercept
|
||||
// insert, update and delete operations and possibly return an error.
|
||||
type ValidateHooks interface {
|
||||
|
||||
// ValidateInsert is called before the message is inserted.
|
||||
// If error is not nil the insertion will fail.
|
||||
ValidateInsert(context.Context, proto.Message) error
|
||||
@@ -30,7 +29,6 @@ type ValidateHooks interface {
|
||||
// may be called but the enclosing transaction may still fail. The context
|
||||
// is provided in each method to help coordinate this.
|
||||
type WriteHooks interface {
|
||||
|
||||
// OnInsert is called after an message is inserted into the store.
|
||||
OnInsert(context.Context, proto.Message)
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
// are stateless, with all state existing only in the store passed
|
||||
// to index methods.
|
||||
type Index interface {
|
||||
|
||||
// List does iteration over the index with the provided prefix key and options.
|
||||
// Prefix key values must correspond in type to the index's fields and the
|
||||
// number of values provided cannot exceed the number of fields in the index,
|
||||
|
||||
@@ -61,8 +61,10 @@ func (i indexKeyIndex) ListRange(ctx context.Context, from, to []interface{}, op
|
||||
return rangeIterator(backend.IndexStoreReader(), backend, i, i.KeyCodec, from, to, options)
|
||||
}
|
||||
|
||||
var _ indexer = &indexKeyIndex{}
|
||||
var _ Index = &indexKeyIndex{}
|
||||
var (
|
||||
_ indexer = &indexKeyIndex{}
|
||||
_ Index = &indexKeyIndex{}
|
||||
)
|
||||
|
||||
func (i indexKeyIndex) doNotImplement() {}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
// Instead you should do reads and writes separately, or use a helper
|
||||
// function like DeleteBy which does this efficiently.
|
||||
type Iterator interface {
|
||||
|
||||
// Next advances the iterator and returns true if a valid entry is found.
|
||||
// Next must be called before starting iteration.
|
||||
Next() bool
|
||||
|
||||
@@ -76,7 +76,6 @@ func (it *paginationIterator) Next() bool {
|
||||
// so the index == total entries.
|
||||
it.pageRes.Total = uint64(it.i)
|
||||
}
|
||||
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@ package ormtable_test
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/orm/model/ormtable"
|
||||
"google.golang.org/grpc/codes"
|
||||
"google.golang.org/grpc/status"
|
||||
"google.golang.org/protobuf/encoding/protojson"
|
||||
"testing"
|
||||
|
||||
"github.com/regen-network/gocuke"
|
||||
"gotest.tools/v3/assert"
|
||||
|
||||
@@ -414,8 +414,10 @@ func (t tableImpl) Get(ctx context.Context, message proto.Message) (found bool,
|
||||
return t.primaryKeyIndex.get(backend, message, keyValues)
|
||||
}
|
||||
|
||||
var _ Table = &tableImpl{}
|
||||
var _ Schema = &tableImpl{}
|
||||
var (
|
||||
_ Table = &tableImpl{}
|
||||
_ Schema = &tableImpl{}
|
||||
)
|
||||
|
||||
type saveMode int
|
||||
|
||||
|
||||
@@ -98,7 +98,6 @@ func TestPaginationLimitCountTotal(t *testing.T) {
|
||||
pr := it.PageResponse()
|
||||
assert.Check(t, pr != nil)
|
||||
assert.Equal(t, uint64(3), pr.Total)
|
||||
|
||||
}
|
||||
|
||||
func TestImportedMessageIterator(t *testing.T) {
|
||||
@@ -187,7 +186,7 @@ func runTestScenario(t *testing.T, table ormtable.Table, backend ormtable.Backen
|
||||
assert.Assert(t, it.Next())
|
||||
msg, err := it.GetMessage()
|
||||
assert.NilError(t, err)
|
||||
//t.Logf("data[%d] %v == %v", i, data[i], msg)
|
||||
// t.Logf("data[%d] %v == %v", i, data[i], msg)
|
||||
assert.DeepEqual(t, data[i], msg, protocmp.Transform())
|
||||
}
|
||||
// make sure the iterator is done
|
||||
@@ -498,7 +497,6 @@ func runTestScenario(t *testing.T, table ormtable.Table, backend ormtable.Backen
|
||||
it, err = store.List(ctx, testpb.ExampleTablePrimaryKey{})
|
||||
assert.NilError(t, err)
|
||||
assertIteratorItems(it, 2, 6, 10)
|
||||
|
||||
}
|
||||
|
||||
func TestRandomTableData(t *testing.T) {
|
||||
@@ -604,7 +602,6 @@ func testIndex(t *testing.T, model *IndexModel) {
|
||||
assert.DeepEqual(t, model.data[i], data2[i], protocmp.Transform())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func reverseData(data []proto.Message) []proto.Message {
|
||||
|
||||
@@ -190,8 +190,10 @@ func (u uniqueKeyIndex) Fields() string {
|
||||
return u.fields.String()
|
||||
}
|
||||
|
||||
var _ indexer = &uniqueKeyIndex{}
|
||||
var _ UniqueIndex = &uniqueKeyIndex{}
|
||||
var (
|
||||
_ indexer = &uniqueKeyIndex{}
|
||||
_ UniqueIndex = &uniqueKeyIndex{}
|
||||
)
|
||||
|
||||
// isNonTrivialUniqueKey checks if unique key fields are non-trivial, meaning that they
|
||||
// don't contain the full primary key. If they contain the full primary key, then
|
||||
|
||||
Reference in New Issue
Block a user