Skip to content

Commit

Permalink
Rename CreateDocument to NewDocument (#341)
Browse files Browse the repository at this point in the history
  • Loading branch information
Fs02 committed Aug 20, 2023
1 parent 26f3b22 commit 0384795
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions collection.go
Expand Up @@ -7,7 +7,7 @@ import (
type slice interface {
table
Reset()
CreateDocument() *Document
NewDocument() *Document
Append(doc *Document)
Get(index int) *Document
Len() int
Expand Down Expand Up @@ -143,12 +143,12 @@ func (c Collection) Reset() {

// Add new document into collection.
func (c Collection) Add() *Document {
c.Append(c.CreateDocument())
c.Append(c.NewDocument())
return c.Get(c.Len() - 1)
}

// CreateDocument returns new document with zero values.
func (c Collection) CreateDocument() *Document {
// NewDocument returns new document with zero values.
func (c Collection) NewDocument() *Document {
return newZeroDocument(c.rt.Elem())
}

Expand Down
4 changes: 2 additions & 2 deletions cursor.go
Expand Up @@ -76,7 +76,7 @@ func scanMulti(cur Cursor, keyField string, keyType reflect.Type, cols map[any][
var doc *Document
for k := range cols {
for _, col := range cols[k] {
doc = col.CreateDocument()
doc = col.NewDocument()
break
}
break
Expand All @@ -97,7 +97,7 @@ func scanMulti(cur Cursor, keyField string, keyType reflect.Type, cols map[any][
}

// create new doc for next scan
doc = doc.CreateDocument()
doc = doc.NewDocument()
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions document.go
Expand Up @@ -261,8 +261,8 @@ func (d Document) association(name string) (Association, bool) {
func (d Document) Reset() {
}

// CreateDocument returns new document with zero values.
func (d Document) CreateDocument() *Document {
// NewDocument returns new document with zero values.
func (d Document) NewDocument() *Document {
return newZeroDocument(d.rt)
}

Expand Down

0 comments on commit 0384795

Please sign in to comment.