repositorypackage
1.1.0
Repository: https://github.com/killernova/goossselect.git
Documentation: pkg.go.dev
# README
goossselect
Ali OSS select package for go
INSTALL
go get -u github.com/killernova/goossselect
USAGE
Step 0: import package
import(gol github.com/killernova/goossselect)
Step 1: create a new selector or meta
s, err := gol.NewSelector("Select * from ossobject")
You can also set options for this generator with defined function or function defined by yourself:
s, err := gol.NewSelector("Select * from ossobject", gol.SetRange("line", 10, 333))
Step 2: create a new config object
c := gol.NewConfig(func(conf *gol.Config) {
conf.AccessKeyID = "ercbcv43tgert"
conf.AccessKeySecret = "sferg456ghvbsf435435"
})
Step 3: call function
data, err = s.SelectQueryToFile("dwl-oss", "links.csv", c)
or you can save data to file
f, err := os.OpenFile("efg.csv", os.O_RDWR|os.O_CREATE, 0755)
if err != nil {
panic(err)
}
defer f.Close()
err = s.SelectQueryToFile("dwl-oss", "links.csv", c, f)
if err != nil {
fmt.Println(err)
}
maybe you want query mate data
m, err := gol.NewMeta()
data, err = m.SelectMeta("dwl-oss", "links.csv", c)
this will return a struct which contains informations of your query csv file
type MetaResponse struct {
Lines int64
Columns int64
Splits int64
ContentLength int64
}
OPTIONS
Most of time you can use the default options, but if you want to change it, use defined functions as follows:
# Selector:
SetFileHeaderInfo(s string)
SetInRecordDelimiter(s string)
SetInFieldDelimiter(s string)
SetOutRecordDelimiter(s string)
SetOutFieldDelimiter(s string)
SetOutputRawData(b bool)
SetKeepAllColumns(b bool)
SetQuoteCharacter(s string)
SetCommentCharacter(s string)
SetRange(s string, start, end int)
# Meta:
SetMetaOverwriteIfExisting(b bool)
SetMetaRecordDelimiter(s string)
SetMetaFieldDelimiter(s string)
SetMetaQuoteCharacter(s string)
You can also use your own functions which receive *Selector or *Meta and return error