Skip to content

Instantly share code, notes, and snippets.

@harisarang
Created December 18, 2021 17:26
Show Gist options
  • Save harisarang/a29fd99a23f3e97033204bdb2275dd99 to your computer and use it in GitHub Desktop.
Save harisarang/a29fd99a23f3e97033204bdb2275dd99 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"io"
"strings"
"github.com/typesense/typesense-go/typesense"
)
func main() {
client := typesense.NewClient(
typesense.WithServer("<host>"),
typesense.WithAPIKey(("<api-key>")))
name := "<coll-name>"
coll, err := client.Collection(name).Documents().Export()
if err != nil {
fmt.Println(err)
}
buf := new(strings.Builder)
_, err = io.Copy(buf, coll)
if err != nil {
fmt.Println(err)
}
fmt.Println(buf.String())
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment