diff options
Diffstat (limited to 'vendor/github.com/go-pg/pg/v10/orm/model_slice.go')
-rw-r--r-- | vendor/github.com/go-pg/pg/v10/orm/model_slice.go | 43 |
1 files changed, 0 insertions, 43 deletions
diff --git a/vendor/github.com/go-pg/pg/v10/orm/model_slice.go b/vendor/github.com/go-pg/pg/v10/orm/model_slice.go deleted file mode 100644 index 1e163629e..000000000 --- a/vendor/github.com/go-pg/pg/v10/orm/model_slice.go +++ /dev/null @@ -1,43 +0,0 @@ -package orm - -import ( - "reflect" - - "github.com/go-pg/pg/v10/internal" - "github.com/go-pg/pg/v10/types" -) - -type sliceModel struct { - Discard - slice reflect.Value - nextElem func() reflect.Value - scan func(reflect.Value, types.Reader, int) error -} - -var _ Model = (*sliceModel)(nil) - -func newSliceModel(slice reflect.Value, elemType reflect.Type) *sliceModel { - return &sliceModel{ - slice: slice, - scan: types.Scanner(elemType), - } -} - -func (m *sliceModel) Init() error { - if m.slice.IsValid() && m.slice.Len() > 0 { - m.slice.Set(m.slice.Slice(0, 0)) - } - return nil -} - -func (m *sliceModel) NextColumnScanner() ColumnScanner { - return m -} - -func (m *sliceModel) ScanColumn(col types.ColumnInfo, rd types.Reader, n int) error { - if m.nextElem == nil { - m.nextElem = internal.MakeSliceNextElemFunc(m.slice) - } - v := m.nextElem() - return m.scan(v, rd, n) -} |