go-client

module
v0.3.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 26, 2026 License: Apache-2.0

README

FigChain Go Client

Official Go client library for FigChain configuration management.

Installation

GitHub Release
go get github.com/figchain/go-client

Quick Start

package main

import (
	"fmt"
	"log"

	"github.com/figchain/go-client/pkg/client"
	"github.com/figchain/go-client/pkg/config"
	"github.com/figchain/go-client/pkg/evaluation"
)

func main() {
	configPath := "path/to/your/client-config.json" // The config that was downloaded in the UI
	// Build the client
	c, err := client.NewClientFromConfig(configPath)
	if err != nil {
		log.Fatalf("Failed to create FigChain client: %v", err)
	}
	defer c.Close()

	// Evaluate a configuration (for traffic split support)
	ctx := evaluation.NewEvaluationContext(map[string]string{
		"userId": "user123",
		"plan":   "premium",
	})

	// Retrieve and decode the configuration
	var cfg MyConfig
	if err := c.GetFig("your-fig-key", &cfg, ctx); err != nil {
		log.Printf("Error getting fig: %v", err)
		return
	}

	fmt.Printf("Feature Enabled: %v\n", cfg.FeatureEnabled)
}

Directories

Path Synopsis
pkg
model
Code generated by avro/gen.
Code generated by avro/gen.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL