config_vars

package
v0.0.0-...-24f2d34 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2024 License: BSD-3-Clause Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Branches

type Branches struct {
	// ActiveMilestones are the active Chromium milestones.
	ActiveMilestones []*chrome_branch.Branch `json:"active_milestones"`
	// Chromium release branches.
	Chromium *chrome_branch.Branches `json:"chromium"`
}

Branches represents named branches in git repositories.

func (*Branches) Copy

func (b *Branches) Copy() *Branches

Copy returns a deep copy of the Branches.

func (*Branches) Validate

func (b *Branches) Validate() error

Validate returns an error if Branches is not valid.

type Registry

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

Registry manages a set of Templates, updating their values when Update is called.

func NewRegistry

func NewRegistry(ctx context.Context, cbc chrome_branch.Client) (*Registry, error)

NewRegistry returns a Registry instance. Implicitly runs Update().

func (*Registry) Register

func (r *Registry) Register(t *Template) error

Register the given Template. Implicitly Updates its value using the most recent Vars.

func (*Registry) Update

func (r *Registry) Update(ctx context.Context) error

Update all of the Templates managed by this Registry by loading new values.

func (*Registry) Vars

func (r *Registry) Vars() *Vars

Vars returns a copy of the current value of the stored Vars.

type Template

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

Template is a text template which uses the contents of Vars. It is technically thread-safe, but users should take care to cache the value of Template.String() rather than calling it repeatedly, unless Update() is only ever called within the same thread as String().

func NewTemplate

func NewTemplate(rawTmpl string) (*Template, error)

NewTemplate returns a Template instance.

func (*Template) Equal

func (t *Template) Equal(t2 *Template) bool

Equal returns true iff the given Template is equivalent to this one. This allows us to test equality using deepequal.DeepEqual, despite the fact that text.Templates are never DeepEqual.

func (*Template) MarshalJSON

func (t *Template) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler.

func (*Template) RawTemplate

func (t *Template) RawTemplate() string

RawTemplate returns the raw string value of the Template.

func (*Template) String

func (t *Template) String() string

String returns the current value of the Template.

func (*Template) UnmarshalJSON

func (t *Template) UnmarshalJSON(b []byte) error

UnmarshalJSON implements json.Unmarshaler.

func (*Template) Update

func (t *Template) Update(v *Vars) error

Update executes the Template using the given Vars and updates its value.

func (*Template) Validate

func (t *Template) Validate() error

Validate returns an error if the Template is not valid.

type Vars

type Vars struct {
	Branches *Branches `json:"branches"`
}

Vars represents current values of variables which may be used in templates.

func FakeVars

func FakeVars() *Vars

FakeVars returns an instance of Vars with arbitrary contents which may be used during validation and testing.

func (*Vars) Copy

func (v *Vars) Copy() *Vars

Copy returns a deep copy of the Vars.

func (*Vars) Validate

func (v *Vars) Validate() error

Validate returns an error if Vars is not valid.

Jump to

Keyboard shortcuts

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