Ali OSS select package for go.
Codes of Auth.go basically come from Ali OSS SDK
go get -u github.com/killernova/goossselect
import(gol github.com/killernova/goossselect)
s, err := gol.NewSelector("Select * from ossobject")
You can also set options for this generator with predefined functions or functions defined by yourself:
s, err := gol.NewSelector("Select * from ossobject", gol.SetRange("line", 10, 333))
c:=gol.NewConfig(func(conf*gol.Config) {
conf.AccessKeyID="ercbcv43tgert"conf.AccessKeySecret="sferg456ghvbsf435435"
})data, err=s.SelectQuery("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)
iferr!=nil {
panic(err)
}
deferf.Close()
err=s.SelectQueryToFile("dwl-oss", "links.csv", c, f)
iferr!=nil {
fmt.Println(err)
}maybe you want query meta 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
typeMetaResponsestruct {
Linesint64Columnsint64Splitsint64ContentLengthint64
}Most of time you can use the default options, but if you want to change it, use predefined functions as follows:
# Selector:
SetFileHeaderInfo(sstring)
SetInRecordDelimiter(sstring)
SetInFieldDelimiter(sstring)
SetOutRecordDelimiter(sstring)
SetOutFieldDelimiter(sstring)
SetOutputRawData(bbool)
SetKeepAllColumns(bbool)
SetQuoteCharacter(sstring)
SetCommentCharacter(sstring)
SetRange(sstring, start, endint)
# Meta:
SetMetaOverwriteIfExisting(bbool)
SetMetaRecordDelimiter(sstring)
SetMetaFieldDelimiter(sstring)
SetMetaQuoteCharacter(sstring)You can also use your own functions which receive *Selector or *Meta and return error