build: add example usage in cmd/main.go and correct build script
This commit is contained in:
4
.github/workflows/go.yml
vendored
4
.github/workflows/go.yml
vendored
@@ -13,10 +13,10 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
|
|
||||||
- name: Set up Go 1.13
|
- name: Set up Go 1.15
|
||||||
uses: actions/setup-go@v1
|
uses: actions/setup-go@v1
|
||||||
with:
|
with:
|
||||||
go-version: 1.13
|
go-version: 1.15
|
||||||
id: go
|
id: go
|
||||||
|
|
||||||
- name: Check out code into the Go module directory
|
- name: Check out code into the Go module directory
|
||||||
|
|||||||
44
cmd/main.go
Normal file
44
cmd/main.go
Normal file
@@ -0,0 +1,44 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/mehanizm/airtable"
|
||||||
|
)
|
||||||
|
|
||||||
|
const (
|
||||||
|
airtableAPIKey = "xxx"
|
||||||
|
airtableDBName = "xxx"
|
||||||
|
airtableTableName = "xxx"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
airtableClient := airtable.NewClient(airtableAPIKey)
|
||||||
|
airtableTable := airtableClient.GetTable(airtableDBName, airtableTableName)
|
||||||
|
|
||||||
|
offset := ""
|
||||||
|
|
||||||
|
for {
|
||||||
|
records, err := airtableTable.GetRecords().
|
||||||
|
WithFilterFormula("NOT({SomeBoolColumn})").
|
||||||
|
ReturnFields("Column1", "Column2", "Column3", "Column4").
|
||||||
|
MaxRecords(100).
|
||||||
|
PageSize(10).
|
||||||
|
WithOffset(offset).
|
||||||
|
Do()
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
|
for recordNum, record := range records.Records {
|
||||||
|
fmt.Println("====iteration====")
|
||||||
|
fmt.Println(recordNum, record)
|
||||||
|
}
|
||||||
|
|
||||||
|
offset = records.Offset
|
||||||
|
if offset == "" {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user