Skip to content

Commit 38785e9

Browse files
mmsqeAlex | Interchain Labs
andauthored
refactor: add named interface for type alias (#127)
* Problem: cannot handle non-empty unnamed interfaces * Apply suggestions from code review Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io> * resolve --------- Co-authored-by: Alex | Interchain Labs <alex@interchainlabs.io>
1 parent 26c353e commit 38785e9

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

types.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ type DB interface {
8181
//
8282
// As with DB, given keys and values should be considered read-only, and must not be modified after
8383
// passing them to the batch.
84-
type Batch = interface {
84+
type BatchI interface {
8585
// Set sets a key/value pair.
8686
// CONTRACT: key, value readonly []byte
8787
Set(key, value []byte) error
@@ -107,6 +107,8 @@ type Batch = interface {
107107
GetByteSize() (int, error)
108108
}
109109

110+
type Batch = BatchI
111+
110112
// Iterator represents an iterator over a domain of keys. Callers must call Close when done.
111113
// No writes can happen to a domain while there exists an iterator over it, some backends may take
112114
// out database locks to ensure this will not happen.
@@ -130,7 +132,7 @@ type Batch = interface {
130132
// if err := itr.Error(); err != nil {
131133
// ...
132134
// }
133-
type Iterator = interface {
135+
type IteratorI interface {
134136
// Domain returns the start (inclusive) and end (exclusive) limits of the iterator.
135137
// CONTRACT: start, end readonly []byte
136138
Domain() (start []byte, end []byte)
@@ -157,3 +159,5 @@ type Iterator = interface {
157159
// Close closes the iterator, relasing any allocated resources.
158160
Close() error
159161
}
162+
163+
type Iterator = IteratorI

0 commit comments

Comments
 (0)