ext

package
v1.51.1 Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultNamespace = &NamespaceEmbed{&Namespace{Key: "default", Name: "Default"}}

Functions

This section is empty.

Types

type Constraint

type Constraint struct {
	Type        string `yaml:"type,omitempty" json:"type,omitempty"`
	Property    string `yaml:"property,omitempty" json:"property,omitempty"`
	Operator    string `yaml:"operator,omitempty" json:"operator,omitempty"`
	Value       string `yaml:"value,omitempty" json:"value,omitempty"`
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
}

type Decoder added in v1.31.0

type Decoder interface {
	Decode(any) error
}

type Distribution

type Distribution struct {
	VariantKey string  `yaml:"variant,omitempty" json:"variant,omitempty"`
	Rollout    float32 `yaml:"rollout,omitempty" json:"rollout,omitempty"`
}

type Document

type Document struct {
	Version   string          `yaml:"version,omitempty" json:"version,omitempty"`
	Namespace *NamespaceEmbed `yaml:"namespace,omitempty" json:"namespace,omitempty"`
	Flags     []*Flag         `yaml:"flags,omitempty" json:"flags,omitempty"`
	Segments  []*Segment      `yaml:"segments,omitempty" json:"segments,omitempty"`
	Etag      string          `yaml:"-" json:"-"`
}

type EncodeCloser added in v1.31.0

type EncodeCloser interface {
	Encoder
	Close() error
}

type Encoder added in v1.31.0

type Encoder interface {
	Encode(any) error
}

type Encoding added in v1.31.0

type Encoding string
const (
	EncodingYML  Encoding = "yml"
	EncodingYAML Encoding = "yaml"
	EncodingJSON Encoding = "json"
)

func (Encoding) NewDecoder added in v1.31.0

func (e Encoding) NewDecoder(r io.Reader) Decoder

func (Encoding) NewEncoder added in v1.31.0

func (e Encoding) NewEncoder(w io.Writer) EncodeCloser

type Exporter

type Exporter struct {
	// contains filtered or unexported fields
}

func NewExporter

func NewExporter(store Lister, namespaces string, allNamespaces, sortByKey bool) *Exporter

func (*Exporter) Export

func (e *Exporter) Export(ctx context.Context, encoding Encoding, w io.Writer) error

type Flag

type Flag struct {
	Key         string         `yaml:"key,omitempty" json:"key,omitempty"`
	Name        string         `yaml:"name,omitempty" json:"name,omitempty"`
	Type        string         `yaml:"type,omitempty" json:"type,omitempty"`
	Description string         `yaml:"description,omitempty" json:"description,omitempty"`
	Enabled     bool           `yaml:"enabled" json:"enabled"`
	Metadata    map[string]any `yaml:"metadata,omitempty" json:"metadata,omitempty"`
	Variants    []*Variant     `yaml:"variants,omitempty" json:"variants,omitempty"`
	Rules       []*Rule        `yaml:"rules,omitempty" json:"rules,omitempty"`
	Rollouts    []*Rollout     `yaml:"rollouts,omitempty" json:"rollouts,omitempty"`
}

type ImportOpt added in v1.23.0

type ImportOpt func(*Importer)

type Importer

type Importer struct {
	// contains filtered or unexported fields
}

func NewImporter

func NewImporter(store Creator, opts ...ImportOpt) *Importer

func (*Importer) Import

func (i *Importer) Import(ctx context.Context, enc Encoding, r io.Reader, skipExisting bool) (err error)

type IsNamespace added in v1.48.0

type IsNamespace interface {
	IsNamespace()
	GetKey() string
}

IsNamespace is used to unify the two types of namespaces that can come in from the import.

type IsSegment added in v1.25.0

type IsSegment interface {
	IsSegment()
}

IsSegment is used to unify the two types of segments that can come in from the import.

type Namespace added in v1.48.0

type Namespace struct {
	Key         string `yaml:"key,omitempty" json:"key,omitempty"`
	Name        string `yaml:"name,omitempty" json:"name,omitempty"`
	Description string `yaml:"description,omitempty" json:"description,omitempty"`
}

func (*Namespace) GetKey added in v1.48.0

func (n *Namespace) GetKey() string

func (*Namespace) IsNamespace added in v1.48.0

func (n *Namespace) IsNamespace()

type NamespaceEmbed added in v1.48.0

type NamespaceEmbed struct {
	IsNamespace `yaml:"-"`
}

func (*NamespaceEmbed) MarshalJSON added in v1.48.0

func (n *NamespaceEmbed) MarshalJSON() ([]byte, error)

MarshalJSON tries to type assert to either of the following types that implement IsNamespace, and returns the marshaled value.

func (*NamespaceEmbed) MarshalYAML added in v1.48.0

func (n *NamespaceEmbed) MarshalYAML() (interface{}, error)

MarshalYAML tries to type assert to either of the following types that implement IsNamespace, and returns the marshaled value.

func (*NamespaceEmbed) String added in v1.48.0

func (n *NamespaceEmbed) String() string

func (*NamespaceEmbed) UnmarshalJSON added in v1.48.0

func (n *NamespaceEmbed) UnmarshalJSON(v []byte) error

UnmarshalJSON attempts to unmarshal a string or `Namespace`, and fails if it can not do so.

func (*NamespaceEmbed) UnmarshalYAML added in v1.48.0

func (n *NamespaceEmbed) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML attempts to unmarshal a string or `Namespace`, and fails if it can not do so.

type NamespaceKey added in v1.48.0

type NamespaceKey string

func (NamespaceKey) GetKey added in v1.48.0

func (n NamespaceKey) GetKey() string

func (NamespaceKey) IsNamespace added in v1.48.0

func (n NamespaceKey) IsNamespace()

type NopCloseEncoder added in v1.31.0

type NopCloseEncoder struct {
	Encoder
}

func (NopCloseEncoder) Close added in v1.31.0

func (n NopCloseEncoder) Close() error

type Rollout added in v1.24.0

type Rollout struct {
	Description string         `yaml:"description,omitempty" json:"description,omitempty"`
	Segment     *SegmentRule   `yaml:"segment,omitempty" json:"segment,omitempty"`
	Threshold   *ThresholdRule `yaml:"threshold,omitempty" json:"threshold,omitempty"`
}

type Rule

type Rule struct {
	Segment       *SegmentEmbed   `yaml:"segment,omitempty" json:"segment,omitempty"`
	Rank          uint            `yaml:"rank,omitempty" json:"rank,omitempty"`
	Distributions []*Distribution `yaml:"distributions,omitempty" json:"distributions,omitempty"`
}

type Segment

type Segment struct {
	Key         string        `yaml:"key,omitempty" json:"key,omitempty"`
	Name        string        `yaml:"name,omitempty" json:"name,omitempty"`
	Description string        `yaml:"description,omitempty" json:"description,omitempty"`
	Constraints []*Constraint `yaml:"constraints,omitempty" json:"constraints,omitempty"`
	MatchType   string        `yaml:"match_type,omitempty" json:"match_type,omitempty"`
}

type SegmentEmbed added in v1.25.0

type SegmentEmbed struct {
	IsSegment `yaml:"-"`
}

func (*SegmentEmbed) MarshalJSON added in v1.31.0

func (s *SegmentEmbed) MarshalJSON() ([]byte, error)

MarshalJSON tries to type assert to either of the following types that implement IsSegment, and returns the marshaled value.

func (*SegmentEmbed) MarshalYAML added in v1.25.0

func (s *SegmentEmbed) MarshalYAML() (interface{}, error)

MarshalYAML tries to type assert to either of the following types that implement IsSegment, and returns the marshaled value.

func (*SegmentEmbed) UnmarshalJSON added in v1.31.0

func (s *SegmentEmbed) UnmarshalJSON(v []byte) error

UnmarshalJSON attempts to unmarshal a string or `SegmentKeys`, and fails if it can not do so.

func (*SegmentEmbed) UnmarshalYAML added in v1.25.0

func (s *SegmentEmbed) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML attempts to unmarshal a string or `SegmentKeys`, and fails if it can not do so.

type SegmentKey added in v1.25.0

type SegmentKey string

func (SegmentKey) IsSegment added in v1.25.0

func (s SegmentKey) IsSegment()

type SegmentRule added in v1.24.0

type SegmentRule struct {
	Key      string   `yaml:"key,omitempty" json:"key,omitempty"`
	Keys     []string `yaml:"keys,omitempty" json:"keys,omitempty"`
	Operator string   `yaml:"operator,omitempty" json:"operator,omitempty"`
	Value    bool     `yaml:"value,omitempty" json:"value,omitempty"`
}

type Segments added in v1.25.0

type Segments struct {
	Keys            []string `yaml:"keys,omitempty" json:"keys,omitempty"`
	SegmentOperator string   `yaml:"operator,omitempty" json:"operator,omitempty"`
}

func (*Segments) IsSegment added in v1.25.0

func (s *Segments) IsSegment()

type ThresholdRule added in v1.24.0

type ThresholdRule struct {
	Percentage float32 `yaml:"percentage,omitempty" json:"percentage,omitempty"`
	Value      bool    `yaml:"value,omitempty" json:"value,omitempty"`
}

type Variant

type Variant struct {
	Default     bool        `yaml:"default,omitempty" json:"default,omitempty"`
	Key         string      `yaml:"key,omitempty" json:"key,omitempty"`
	Name        string      `yaml:"name,omitempty" json:"name,omitempty"`
	Description string      `yaml:"description,omitempty" json:"description,omitempty"`
	Attachment  interface{} `yaml:"attachment,omitempty" json:"attachment,omitempty"`
}

Jump to

Keyboard shortcuts

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