Documentation
¶
Index ¶
- type AvroRecord
- type Client
- func (c *Client) Close() error
- func (c *Client) GetFig(key string, target any, ctx *evaluation.EvaluationContext) error
- func (c *Client) GetFigRaw(key string, ctx *evaluation.EvaluationContext) ([]byte, error)
- func (c *Client) RegisterListener(key string, prototype AvroRecord, callback func(AvroRecord))
- func (c *Client) RegisterRawListener(key string, callback func(string, []byte))
- func (c *Client) Watch(ctx context.Context, key string) <-chan model.FigFamily
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AvroRecord ¶
AvroRecord is an interface that provides the Avro schema.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the main entry point for the FigChain client.
func NewClientFromConfig ¶ added in v0.2.1
NewClientFromConfig creates a new Client from a JSON configuration file. Prioritizes Env vars over Config file, but Options over everything.
func (*Client) GetFig ¶
func (c *Client) GetFig(key string, target any, ctx *evaluation.EvaluationContext) error
GetFig retrieves a configuration and deserializes it into target.
func (*Client) GetFigRaw ¶ added in v0.2.2
func (c *Client) GetFigRaw(key string, ctx *evaluation.EvaluationContext) ([]byte, error)
GetFigRaw retrieves the raw (decrypted if necessary) payload for a specific key. This allows the caller to handle deserialization (e.g. using generated code directly).
func (*Client) RegisterListener ¶ added in v0.1.1
func (c *Client) RegisterListener(key string, prototype AvroRecord, callback func(AvroRecord))
RegisterListener registers a callback for updates to a specific key. The callback is invoked with the deserialized object when an update occurs.
IMPORTANT: This feature should be used for SERVER-SCOPED configuration only (e.g. global flags). The update is evaluated with an empty context. If your rules depend on user-specific attributes (like request-scoped context), this listener may receive default values or fail to match rules. For request-scoped configuration, use GetFig() with the appropriate context when needed.
func (*Client) RegisterRawListener ¶ added in v0.2.2
RegisterRawListener registers a callback for updates to a specific key, returning the raw payload. This allows the caller to handle deserialization.
IMPORTANT: This feature should be used for SERVER-SCOPED configuration only (e.g. global flags). The update is evaluated with an empty context. If your rules depend on user-specific attributes (like request-scoped context), this listener may receive default values or fail to match rules. For request-scoped configuration, use GetFig() with the appropriate context when needed.