mirror of
https://github.com/bitechdev/ResolveSpec.git
synced 2026-10-04 12:31:58 +00:00
Tests / Integration Tests (push) Failing after 1m39s
Build , Vet Test, and Lint / Build (push) Successful in 2m3s
Tests / Unit Tests (push) Successful in 2m8s
Build , Vet Test, and Lint / Lint Code (push) Successful in 2m51s
Build , Vet Test, and Lint / Run Vet Tests (1.24.x) (push) Successful in 2m57s
Build , Vet Test, and Lint / Run Vet Tests (1.23.x) (push) Successful in 2m59s
Tests / Race Detector (push) Successful in 5m9s
Move .github/workflows to .gitea/workflows with Gitea-compatible action versions, fix make_tag outputs/major bump, and add release_clients.yml to build and publish all clients to the Gitea package registries. Rename the Go client module to git.warky.dev/wdevs and add LICENSE/CHANGELOG for Dart.
41 lines
1.5 KiB
Markdown
41 lines
1.5 KiB
Markdown
# resolvespec-go
|
|
|
|
Go client for ResolveSpec (JSON body) and FunctionSpec. Module: `git.warky.dev/wdevs/ResolveSpec/clients/resolvespec-go`. Stdlib only.
|
|
|
|
## Clients
|
|
|
|
| Type | Constructor | Methods |
|
|
|---|---|---|
|
|
| `Client` | `NewClient(baseURL, opts...)` | `GetMetadata` `Read` `Create` `Update` `Delete` |
|
|
| `FuncSpecClient` | `NewFuncSpecClient(baseURL, opts...)` | `Query` `QueryList` `Do` |
|
|
|
|
Client options: `WithToken`, `WithHeader`, `WithHTTPClient`. Precedence: Content-Type < custom headers < bearer token.
|
|
|
|
## ResolveSpec
|
|
|
|
- All methods take `ctx`; `Read`/`Update`/`Delete` take `RecordID` (`nil`, int/string → URL, `[]string` → body).
|
|
- `Options` fields use pointers for optional ints/bools (`Int(n)`, `Bool(b)`).
|
|
- Result: `*Response{Success, Data (raw JSON), Metadata}`; `resp.Decode(&v)`.
|
|
|
|
## FunctionSpec
|
|
|
|
- Routes are server-defined: pass the `path`.
|
|
- `Params` → query string (slice → repeated keys, bool → `true`/`false`).
|
|
- `FuncSpecOptions` → `X-*` headers: `Filters`, `SearchFilters`, `CustomSQLWhere`, `CustomSQLOr`, `Sort`, `Limit`, `Offset`, `Distinct`, `SkipCount`, `SkipCache`, `ResponseFormat`.
|
|
- `QueryList` fills `Metadata` from `Content-Range` (`items a-b/total`); 206 is success.
|
|
|
|
## Server quirks
|
|
|
|
- `Sort` is raw SQL in ORDER BY (client sends `col ASC|DESC`).
|
|
- One search operator per column.
|
|
- Values starting `ZIP_` / `__` are base64-decoded by the server.
|
|
- Non-ASCII, control chars and edge spaces are auto-encoded (`ZIP_`).
|
|
|
|
## Errors
|
|
|
|
`*Error{StatusCode, APIError{Code, Message, Detail, SQL}}`.
|
|
|
|
## Test
|
|
|
|
`go test ./...`
|