Documentation
¶
Index ¶
- Variables
- func FilterFromAST(ast string) (string, error)
- func FilterToAST(dql string) (string, error)
- func IsNotFound(err error) bool
- type FilterSegment
- type FilterSegmentList
- type Handler
- func (h *Handler) Create(data []byte) (*FilterSegment, error)
- func (h *Handler) Delete(uid string) error
- func (h *Handler) Get(uid string) (*FilterSegment, error)
- func (h *Handler) GetRaw(uid string) ([]byte, error)
- func (h *Handler) List() (*FilterSegmentList, error)
- func (h *Handler) Update(uid string, version int, data []byte) error
- type Include
- type Variables
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = sdksegment.ErrNotFound
ErrNotFound is returned when a segment is not found (HTTP 404).
Functions ¶
func FilterFromAST ¶
FilterFromAST converts a JSON AST string back to a DQL filter expression. If the input is not a JSON AST (doesn't start with '{'), it is returned as-is.
func FilterToAST ¶
FilterToAST converts a DQL filter expression to a JSON AST string. If the input is already a JSON AST (starts with '{'), it is returned as-is.
func IsNotFound ¶
IsNotFound returns true if the error indicates a segment was not found (404).
Types ¶
type FilterSegment ¶
type FilterSegment struct {
UID string `json:"uid" table:"UID"`
Name string `json:"name" table:"NAME"`
Description string `json:"description,omitempty" table:"DESCRIPTION,wide"`
IsPublic bool `json:"isPublic" table:"PUBLIC"`
VariablesDisplay string `json:"-" yaml:"-" table:"VARIABLES,wide"`
Owner string `json:"owner,omitempty" table:"OWNER,wide"`
Version int `json:"version,omitempty" table:"-"`
IsReadyMade bool `json:"isReadyMade,omitempty" table:"-"`
Includes []Include `json:"includes,omitempty" table:"-"`
Variables *Variables `json:"variables,omitempty" table:"-"`
AllowedOperations []string `json:"allowedOperations,omitempty" table:"-"`
}
FilterSegment is the read model for a Grail filter segment. It extends the SDK type with VariablesDisplay for CLI table output.
type FilterSegmentList ¶
type FilterSegmentList struct {
FilterSegments []FilterSegment `json:"filterSegments"`
TotalCount int `json:"totalCount,omitempty"`
}
FilterSegmentList represents a list of filter segments. The filter-segments API does not support pagination; all segments are returned in a single response.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler handles Grail filter segment resources. It delegates HTTP calls to the SDK handler and wraps them with DQL↔AST conversion.
func NewHandler ¶
NewHandler creates a new segment handler.
func (*Handler) Create ¶
func (h *Handler) Create(data []byte) (*FilterSegment, error)
Create creates a new filter segment from raw JSON/YAML bytes.
func (*Handler) Get ¶
func (h *Handler) Get(uid string) (*FilterSegment, error)
Get gets a specific filter segment by UID.
func (*Handler) GetRaw ¶
GetRaw gets a segment as pretty-printed JSON bytes (for edit command). Note: the returned JSON contains DQL filter expressions (not raw API AST) because it delegates to Get, which converts AST filters to DQL.
func (*Handler) List ¶
func (h *Handler) List() (*FilterSegmentList, error)
List lists all filter segments. Variables are requested so the wide table view can show whether each segment requires variable bindings.
type Include ¶
type Include = sdksegment.Include
Include represents a single include rule within a segment.
type Variables ¶
type Variables = sdksegment.Variables
Variables holds the variable configuration for a segment.