mirror of
https://github.com/featurebasedb/featurebase.git
synced 2026-10-15 07:18:04 +00:00
i used this script, a little clunky but it got the job done
```bash
for file in `find . -type f -print | grep '\.go'`; do
sed '1,/^\/\/ limitations under the License.$/d' $file > $file.tmp;
result=`cat $file.tmp`
if [[ result != "" ]]; then
gofmt $file.tmp &> /dev/null;
if [[ $? == 0 ]]; then
mv $file.tmp $file && gofmt -w $file;
else
rm $file.tmp;
fi
else
rm $file.tmp;
fi
done
```
54 lines
1.1 KiB
Go
54 lines
1.1 KiB
Go
// package ctl contains all pilosa subcommands other than 'server'. These are
|
|
// generally administration, testing, and debugging tools.
|
|
|
|
/*
|
|
Package client enables querying a Pilosa server.
|
|
|
|
This client uses Pilosa's http+protobuf API.
|
|
|
|
Usage:
|
|
|
|
import (
|
|
"fmt"
|
|
"github.com/molecula/featurebase/v2/client"
|
|
)
|
|
|
|
// Create a Client instance
|
|
cli := client.DefaultClient()
|
|
|
|
// Create a Schema instance
|
|
schema, err := cli.Schema()
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Create an Index instance
|
|
index, err := schema.Index("repository")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Create a Field instance
|
|
stargazer, err := index.Field("stargazer")
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Sync the schema with the server-side, so non-existing indexes/fields are created on the server-side.
|
|
err = cli.SyncSchema(schema)
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Execute a query
|
|
response, err := cli.Query(stargazer.Row(5))
|
|
if err != nil {
|
|
panic(err)
|
|
}
|
|
|
|
// Act on the result
|
|
fmt.Println(response.Result())
|
|
|
|
See also https://www.pilosa.com/docs/api-reference/ and https://www.pilosa.com/docs/query-language/.
|
|
*/
|
|
package client
|