Skip to content

Commit 6cccd93

Browse files
committed
spell fix
1 parent 2dab03e commit 6cccd93

File tree

4 files changed

+12
-14
lines changed

4 files changed

+12
-14
lines changed

get.go

+1-3
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type PaginationOptions struct {
5858
// Limit is the limit of pagination result.
5959
Limit uint64
6060
// Backward indicates the direction to fetch results from the cursor.
61-
// The same result can be acheived by reversing the order.
61+
// The same result can be achieved by reversing the order.
6262
//
6363
// As an example, for documents ordered by their creation time,
6464
// With the cursor at the 50th record, one can keep fetching the next 50, and the next 50, and so on
@@ -129,8 +129,6 @@ func (s *Store[T, Q]) Get(ctx context.Context, id string, opts GetOptions) (*Get
129129
}
130130

131131
// Query queries the store and returns all matching documents.
132-
//
133-
// TODO: Add load revisions
134132
func (s *Store[T, Q]) Query(ctx context.Context, q Q, opts QueryOptions) (*QueryResult[T], error) {
135133
selection := any(ColDoc)
136134
if len(s.fields) > 0 && len(opts.ViewMask) > 0 {

pagination.go

+9-9
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
)
1111

1212
const (
13-
seperator = ":"
13+
separator = ":"
1414
)
1515

1616
func addPagination(st *sq.SelectBuilder, scans []any, op *PaginationOptions, orderBy []OrderBy) (*sq.SelectBuilder, []any, error) {
@@ -124,7 +124,7 @@ func (i OrderByInt) Name() string {
124124
}
125125

126126
func (OrderByInt) Encode(v any, id string) string {
127-
return base64.URLEncoding.EncodeToString([]byte(strconv.FormatInt(*v.(*int64), 10) + seperator + id))
127+
return base64.URLEncoding.EncodeToString([]byte(strconv.FormatInt(*v.(*int64), 10) + separator + id))
128128
}
129129
func (OrderByInt) Decode(cursor string) (any, string, error) {
130130
dataBytes, err := base64.URLEncoding.DecodeString(cursor)
@@ -133,7 +133,7 @@ func (OrderByInt) Decode(cursor string) (any, string, error) {
133133
}
134134

135135
data := string(dataBytes)
136-
splits := strings.SplitN(data, seperator, 2)
136+
splits := strings.SplitN(data, separator, 2)
137137
if len(splits) != 2 {
138138
return nil, "", ErrInvalidCursor
139139
}
@@ -154,7 +154,7 @@ func (i OrderByFloat) Name() string {
154154
}
155155

156156
func (OrderByFloat) Encode(v any, id string) string {
157-
return base64.URLEncoding.EncodeToString([]byte(strconv.FormatFloat(*v.(*float64), 'g', 2, 64) + seperator + id))
157+
return base64.URLEncoding.EncodeToString([]byte(strconv.FormatFloat(*v.(*float64), 'g', 2, 64) + separator + id))
158158
}
159159
func (OrderByFloat) Decode(cursor string) (any, string, error) {
160160
dataBytes, err := base64.URLEncoding.DecodeString(cursor)
@@ -163,7 +163,7 @@ func (OrderByFloat) Decode(cursor string) (any, string, error) {
163163
}
164164

165165
data := string(dataBytes)
166-
splits := strings.SplitN(data, seperator, 2)
166+
splits := strings.SplitN(data, separator, 2)
167167
if len(splits) != 2 {
168168
return nil, "", ErrInvalidCursor
169169
}
@@ -184,7 +184,7 @@ func (i OrderByString) Name() string {
184184
}
185185

186186
func (OrderByString) Encode(v any, id string) string {
187-
return base64.URLEncoding.EncodeToString([]byte(base64.URLEncoding.EncodeToString([]byte(*v.(*string))) + seperator + id))
187+
return base64.URLEncoding.EncodeToString([]byte(base64.URLEncoding.EncodeToString([]byte(*v.(*string))) + separator + id))
188188
}
189189
func (OrderByString) Decode(cursor string) (any, string, error) {
190190
dataBytes, err := base64.URLEncoding.DecodeString(cursor)
@@ -193,7 +193,7 @@ func (OrderByString) Decode(cursor string) (any, string, error) {
193193
}
194194

195195
data := string(dataBytes)
196-
splits := strings.SplitN(data, seperator, 2)
196+
splits := strings.SplitN(data, separator, 2)
197197
if len(splits) != 2 {
198198
return nil, "", ErrInvalidCursor
199199
}
@@ -214,7 +214,7 @@ func (i OrderByTime) Name() string {
214214
}
215215

216216
func (OrderByTime) Encode(v any, id string) string {
217-
return base64.URLEncoding.EncodeToString([]byte(base64.URLEncoding.EncodeToString([]byte((*v.(*time.Time)).Format(time.RFC3339))) + seperator + id))
217+
return base64.URLEncoding.EncodeToString([]byte(base64.URLEncoding.EncodeToString([]byte((*v.(*time.Time)).Format(time.RFC3339))) + separator + id))
218218
}
219219
func (OrderByTime) Decode(cursor string) (any, string, error) {
220220
dataBytes, err := base64.URLEncoding.DecodeString(cursor)
@@ -223,7 +223,7 @@ func (OrderByTime) Decode(cursor string) (any, string, error) {
223223
}
224224

225225
data := string(dataBytes)
226-
splits := strings.SplitN(data, seperator, 2)
226+
splits := strings.SplitN(data, separator, 2)
227227
if len(splits) != 2 {
228228
return nil, "", ErrInvalidCursor
229229
}

store.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ type Store[T any, Q Sqlizer] struct {
5858

5959
// NewStore returns a new store.
6060
//
61-
// Typically this is never direclty called. It is called via a more concrete generated function.
61+
// Typically this is never directly called. It is called via a more concrete generated function.
6262
// See protoc-gen-nidhi.
6363
func NewStore[T any, Q Sqlizer](
6464
ctx context.Context,

update.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ type UpdateResult struct {
3737

3838
// Replace replaces a document, matched using it's id, in the store.
3939
//
40-
// Retuns a NotFound error, if the document doesn't exist or the revision doesn't exist.
40+
// Returns a NotFound error, if the document doesn't exist or the revision doesn't exist.
4141
func (s *Store[T, Q]) Replace(ctx context.Context, doc *T, opts ReplaceOptions) (*ReplaceResult, error) {
4242
docJSON, err := getJson(doc)
4343
if err != nil {

0 commit comments

Comments
 (0)