{"id":13514287,"url":"https://github.com/fauna/faunadb-go","last_synced_at":"2025-04-09T05:11:56.807Z","repository":{"id":44159717,"uuid":"65325698","full_name":"fauna/faunadb-go","owner":"fauna","description":"Go driver for Fauna v4 (deprecated)","archived":false,"fork":false,"pushed_at":"2024-09-12T18:46:02.000Z","size":482,"stargazers_count":185,"open_issues_count":4,"forks_count":25,"subscribers_count":28,"default_branch":"v4","last_synced_at":"2025-04-02T04:04:40.847Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://docs.fauna.com/fauna/v4/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fauna.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-09T20:24:13.000Z","updated_at":"2025-01-22T21:52:55.000Z","dependencies_parsed_at":"2024-08-28T20:45:42.137Z","dependency_job_id":"18d53d27-f899-461b-afce-cc539b7a68ff","html_url":"https://github.com/fauna/faunadb-go","commit_stats":null,"previous_names":["faunadb/faunadb-go"],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauna%2Ffaunadb-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauna%2Ffaunadb-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauna%2Ffaunadb-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fauna%2Ffaunadb-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fauna","download_url":"https://codeload.github.com/fauna/faunadb-go/tar.gz/refs/heads/v4","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247980844,"owners_count":21027808,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T05:00:51.784Z","updated_at":"2025-04-09T05:11:56.792Z","avatar_url":"https://github.com/fauna.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# Golang driver for Fauna v4 (deprecated)\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/fauna/faunadb-go)](https://goreportcard.com/report/github.com/fauna/faunadb-go)\n[![GoDoc](https://godoc.org/github.com/fauna/faunadb-go/faunadb?status.svg)](https://pkg.go.dev/github.com/fauna/faunadb-go/v4)\n[![License](https://img.shields.io/badge/license-MPL_2.0-blue.svg?maxAge=2592000)](https://raw.githubusercontent.com/fauna/faunadb-go/main/LICENSE)\n\n\u003e [!WARNING]\n\u003e  Fauna is decommissioning FQL v4 on June 30, 2025.\n\u003e\n\u003e This driver is not compatible with FQL v10, the latest version. Fauna accounts\n\u003e created after August 21, 2024 must use FQL v10. Ensure you migrate existing\n\u003e projects to the official v10 driver by the v4 EOL date:\n\u003e https://github.com/fauna/fauna-go.\n\u003e\n\u003e For more information, see the [v4 end of life (EOL)\n\u003e announcement](https://docs.fauna.com/fauna/v4/#fql-v4-end-of-life) and\n\u003e [related FAQ](https://docs.fauna.com/fauna/v4/migration/faq).\n\nThe official Golang driver for [Fauna v4](https://docs.fauna.com/fauna/v4/).\n\nSee the [Fauna v4 documentation](https://docs.fauna.com/fauna/v4) and\n[Tttorials](https://docs.fauna.com/fauna/v4/learn/tutorials/fql/crud?lang=javascript)\nfor guides and a complete database [API\nreference](https://docs.fauna.com/fauna/v4/api/fql/).\n\n## Supported Go Versions\n\nCurrently, the driver is tested on:\n- 1.13\n- 1.14\n- 1.15\n- 1.16\n\n## Using the Driver\n\n### Installing\n\nTo get the latest version run:\n\n```bash\ngo get github.com/fauna/faunadb-go/v4/faunadb\n```\n\nPlease note that our driver undergoes breaking changes from time to time, so depending on our `main` branch is not recommended.\nIt is recommended to use one of the following methods instead:\n\n### Importing\n\nFor better usage, we recommend that you import this driver with an alias import.\n\n#### Using `dep` or `go get`\n\nTo import a specific version when using `go get`, use:\n\n```go\nimport f \"github.com/fauna/faunadb-go/v4/faunadb\"\n```\n\n### Basic Usage\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\tf \"github.com/fauna/faunadb-go/v4/faunadb\"\n)\n\ntype User struct {\n\tName string `fauna:\"name\"`\n}\n\nfunc main() {\n\tclient := f.NewFaunaClient(\"your-secret-here\")\n\n\tres, err := client.Query(f.Get(f.Ref(f.Collection(\"user\"), \"42\")))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\n\tvar user User\n\n\tif err := res.At(f.ObjKey(\"data\")).Get(\u0026user); err != nil {\n\t\tpanic(err)\n\t}\n\n\tfmt.Println(user)\n}\n```\n\n### Streaming feature usage\n```go\npackage main\n\nimport f \"github.com/fauna/faunadb-go/v4/faunadb\"\n\nfunc main() {\n\tsecret := \"\"\n\tdbClient = f.NewFaunaClient(secret)\n\tvar ref f.RefV\n\tvalue, err := dbClient.Query(f.Get(\u0026ref))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\terr = value.At(f.ObjKey(\"ref\")).Get(\u0026docRef)\n\tvar subscription f.StreamSubscription\n\tsubscription = dbClient.Stream(docRef)\n\terr = subscription.Start()\n\tif err != nil {\n\t\tpanic(\"Panic\")\n\t}\n\tfor a := range subscription.StreamEvents() {\n\t\tswitch a.Type() {\n\n\t\tcase f.StartEventT:\n\t\t\t// do smth on start event\n\n\t\tcase f.HistoryRewriteEventT:\n\t\t\t// do smth on historyRewrite event\n\n\t\tcase f.VersionEventT:\n\t\t\t// do smth on version event\n\n\t\tcase f.ErrorEventT:\n\t\t\t// do smth on error event\n\t\t\tsubscription.Close() // if you want to close streaming on errors\n\t\t}\n\t}\n}\n```\n\n### Omitempty usage\n```go\npackage main\n\nimport f \"github.com/fauna/faunadb-go/v4/faunadb\"\n\nfunc main() {\n\tsecret := \"\"\n\tdbClient = f.NewFaunaClient(secret)\n\tvar ref f.RefV\n\tvalue, err := dbClient.Query(f.Get(\u0026ref))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\ttype OmitStruct struct {\n\t\tName           string      `fauna:\"name,omitempty\"`\n\t\tAge            int         `fauna:\"age,omitempty\"`\n\t\tPayment        float64     `fauna:\"payment,omitempty\"`\n\t\tAgePointer     *int        `fauna:\"agePointer,omitempty\"`\n\t\tPaymentPointer *float64    `fauna:\"paymentPointer,omitempty\"`\n\t}\n\t_, err := dbClient.Query(\n\t\tf.Create(f.Collection(\"categories\"), f.Obj{\"data\": OmitStruct{Name: \"John\", Age: 0}}))\n\tif err != nil {\n\t\tpanic(err)\n\t}\n}\n```\n**Result (empty/zero fields will be ignored):**\n```text\n{\n  \"ref\": Ref(Collection(\"categories\"), \"295143889346494983\"),\n  \"ts\": 1617729997710000,\n  \"data\": {\n    \"name\": \"John\"\n  }\n}\n```\n### Http2 support\nDriver uses http2 by default. To use http 1.x provide custom http client to `FaunaClient`\n```go\npackage main\n\nimport f \"github.com/fauna/faunadb-go/v4/faunadb\"\n\nfunc main() {\n\tsecret := \"\"\n\tcustomHttpClient := http.Client{}\n\tdbClient = f.NewFaunaClient(secret, f.HTTP(\u0026customHttpClient))\n}\n```\n\u003cbr\u003e\nFor more information about Fauna Query Language (FQL), consult our query language\n[reference documentation](https://docs.fauna.com/fauna/v4/api/fql/).\n\nSpecific reference documentation for the driver is hosted at\n[GoDoc](https://pkg.go.dev/github.com/fauna/faunadb-go/v4).\n\n\nMost users found tests for the driver as a very useful form of documentation\n[Check it out here](https://github.com/fauna/faunadb-go/tree/main/faunadb).\n\n\n## Contributing\n\nGitHub pull requests are very welcome.\n\n### Driver Development\n\nRun `go get -t ./...` in order to install project's dependencies.\n\nRun tests against FaunaDB Cloud by passing your root database key to the\ntest suite, as follows: `FAUNA_ROOT_KEY=\"your-cloud-secret\" go test ./...`.\n\nIf you have access to another running FaunaDB database, use the\n`FAUNA_ENDPOINT` environment variable to specify its URI.\n\nAlternatively, tests can be run via a Docker container with\n`FAUNA_ROOT_KEY=\"your-cloud-secret\" make docker-test` (an alternate\nDebian-based Go image can be provided via `RUNTIME_IMAGE`).\n\nTip: Setting the `FAUNA_QUERY_TIMEOUT_MS` environment variable will\nset a timeout in milliseconds for all queries.\n\n## LICENSE\n\nCopyright 2020 [Fauna, Inc.](https://fauna.com/)\n\nLicensed under the Mozilla Public License, Version 2.0 (the\n\"License\"); you may not use this software except in compliance with\nthe License. You may obtain a copy of the License at\n\n[http://mozilla.org/MPL/2.0/](http://mozilla.org/MPL/2.0/)\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\nimplied. See the License for the specific language governing\npermissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffauna%2Ffaunadb-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffauna%2Ffaunadb-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffauna%2Ffaunadb-go/lists"}