rows

package module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 24, 2021 License: MIT Imports: 10 Imported by: 2

README

rows

Build Status Go Report Card GoDoc GitHub license gocover.io

An rows reads the parsing library

MIT License

Pouch is licensed under the MIT License. See LICENSE for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidType = errors.New("Invalid type")
	ErrNotPointer  = errors.New("Destination not a pointer")
	ErrPointerNil  = errors.New("destination pointer is nil")
)

Some common error definitions

View Source
var (
	MaxForkSize  = 16
	MakeSliceCap = 1024 * 16
	MaxBuffer    = 1024
)

Some global parameters

Functions

func ConvertAssign

func ConvertAssign(dest interface{}, src []byte) error

ConvertAssign copies to dest the value in src, converting it if possible. An error is returned if the copy would result in loss of information. dest should be a pointer type.

func DataScanBytes

func DataScanBytes(key []string, data [][][]byte, v interface{}, fn func(reflect.StructField) string) (int, error)

DataScanBytes fill in key and data to v

func DataScanChannel

func DataScanChannel(key []string, data chan [][]byte, v interface{},
	fn func(reflect.StructField) string, f int) (int, error)

DataScanChannel fill in key and data to v

func MakeFieldName

func MakeFieldName(tag string) func(fn reflect.StructField) string

MakeFieldName returns a function that gets the value of a field

func RowsLimitBytes

func RowsLimitBytes(rows Rows, limit int) ([]string, [][][]byte, error)

RowsLimitBytes if limit >= 0 Read maximum rows limit else < 0 Not limited

func RowsLimitChannel

func RowsLimitChannel(rows Rows, limit int) ([]string, chan [][]byte, error)

RowsLimitChannel if limit >= 0 Read maximum rows limit else < 0 Not limited

func RowsScan

func RowsScan(rows Rows, v interface{}, limit int,
	fn func(reflect.StructField) string, f int) (int, error)

RowsScan v should be a pointer type. SupportType:

Basic Type
Slices
Array
Pointer
Struct
map[string]string
*map[string]string
map[string][]byte
*map[string][]byte

Example:

[100]map[string]string   Get 100 lines to map
map[string]string        Get 1 lines to map
[]*struct                All to *struct
*[100]struct             Get 100 lines to struct
var ret [100]map[string]string
DataScan(key, data, &ret)

func RowsScanBytes

func RowsScanBytes(rows Rows, v interface{}, limit int,
	fn func(reflect.StructField) string) (int, error)

RowsScanBytes fill in rows to v

func RowsScanChannel

func RowsScanChannel(rows Rows, v interface{}, limit int,
	fn func(reflect.StructField) string, f int) (int, error)

RowsScanChannel fill in rows to v

func StringToBytes added in v1.0.3

func StringToBytes(v string) []byte

StringToBytes string to []byte

func StringsToBytess added in v1.0.3

func StringsToBytess(v []string) [][]byte

StringsToBytess []string to [][]byte

func StringssToBytesss added in v1.0.3

func StringssToBytesss(v [][]string) [][][]byte

StringssToBytesss [][]string to [][][]byte

Types

type Rows

type Rows interface {
	Next() bool
	Columns() ([]string, error)
	Scan(dest ...interface{}) error
	Err() error
	Close() error
}

Rows Handle multiline interfaces

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL