github.com/gemaraproj/gemara@v0.23.0

docs/sdk/go-sdk.md raw

 1---
 2layout: page
 3title: Go SDK
 4---
 5
 6The Go SDK provides type-safe APIs for reading, writing, and manipulating Gemara documents. Types are generated from CUE schemas using [cuegen](https://github.com/gemaraproj/cuegen).
 7
 8**[Go Package Reference →](https://pkg.go.dev/github.com/gemaraproj/go-gemara)**
 9
10## Installation
11
12```bash
13go get github.com/gemaraproj/go-gemara
14```
15
16## Usage
17
18```go
19import "github.com/gemaraproj/go-gemara"
20
21// Load a control catalog
22catalog := &gemara.Catalog{}
23catalog, err := catalog.LoadFile("file://controls.yaml")
24if err != nil {
25    log.Fatal(err)
26}
27
28// Access controls
29for _, control := range catalog.Controls {
30    fmt.Printf("Control: %s - %s\n", control.ID, control.Title)
31}
32```
33
34## Relationship to Other Components
35
36### [The Model](../model)
37Provides the conceptual foundation. Go SDK types correspond to elements in the model.
38
39### [The Schemas](../schema/)
40Go SDK types are generated from the CUE schemas, ensuring consistency between validation and programmatic access.