-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathmain.go
34 lines (29 loc) · 852 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package main
import (
"fmt"
"log"
"github.com/sqlitebrowser/go-dbhub"
)
func main() {
// Create a new DBHub.io API object
db, err := dbhub.New("YOUR_API_KEY_HERE")
if err != nil {
log.Fatal(err)
}
// Retrieve the column info for a table or view in the remote database
table := "table1"
columns, err := db.Columns("justinclift", "Join Testing.sqlite", dbhub.Identifier{Branch: "master"}, table)
if err != nil {
log.Fatal(err)
}
// Display the retrieved column details
fmt.Printf("Columns on table or view '%s':\n", table)
for _, j := range columns {
fmt.Printf(" * '%v':\n", j.Name)
fmt.Printf(" Cid: %v\n", j.Cid)
fmt.Printf(" Data Type: %v\n", j.DataType)
fmt.Printf(" Default Value: %v\n", j.DfltValue)
fmt.Printf(" Not Null: %v\n", j.NotNull)
fmt.Printf(" Primary Key: %v\n", j.Pk)
}
}