Versions in this module Expand all Collapse all v0 v0.1.0 Nov 15, 2026 Changes in this version + const AssetNameBanner + const AssetNameIcon + const AssetNameLogo + const AssetNameMain + const FieldNameAddress + const FieldNameBrandname + const FieldNameContent + const FieldNameDescription + const FieldNameLikes + const FieldNamePhone + const FieldNameRating + const FieldNameSponsored + const FieldNameTitle + const FieldNameURL + const NavigateBack + const NavigateClose + const Unlimited + var ErrFieldInvalidType = errors.New("adformat: field value has invalid type") + var ErrFieldIsRequired = errors.New("adformat: field is required") + func DecodeBindingParams[P any](bindings []Binding, target string) (P, bool) + func ParseAspectRatio(s string) (w, h float64, err error) + type Accessor interface + DirectFormatSet func() *searchtypes.NumberBitset[uint] + FormatByCode func(code string) *Format + FormatByID func(id uint64) *Format + Formats func() []*Format + FormatsBySize func(width, height int) []*Format + type AltTextRequirement struct + MaxLength int + Required bool + type AssetRequirement struct + AllowAnimated bool + AllowSound bool + AllowedCodecs []string + AllowedFramerates []float64 + AllowedTypes []string + AltText *AltTextRequirement + AspectRatio string + Bindings []Binding + BitrateMax int + BitrateMin int + Condition *Condition + DurationMax float64 + DurationMin float64 + FocalPoint *FocalPoint + Height int + MaxCount int + MaxFileSize int64 + MaxHeight int + MaxWidth int + MinCount int + MinHeight int + MinWidth int + Name string + NavigateTo string + Required bool + Resizable bool + SafeZone *SafeZone + Thumbs []Thumb + Width int + func Asset(name string) AssetRequirement + func (a AssetRequirement) Animated() AssetRequirement + func (a AssetRequirement) AspectRatioValue() (w, h float64, ok bool) + func (a AssetRequirement) Bind(b Binding) AssetRequirement + func (a AssetRequirement) Bitrate(min, max int) AssetRequirement + func (a AssetRequirement) Codecs(codecs ...string) AssetRequirement + func (a AssetRequirement) Count(min, max int) AssetRequirement + func (a AssetRequirement) Duration(min, max float64) AssetRequirement + func (a AssetRequirement) ExactSize(width, height int) AssetRequirement + func (a AssetRequirement) Focal(x, y float64) AssetRequirement + func (a AssetRequirement) Framerates(fps ...float64) AssetRequirement + func (a AssetRequirement) GetMaxCount() int + func (a AssetRequirement) GetMinCount() int + func (a AssetRequirement) GetName() string + func (a AssetRequirement) IsFixedSize() bool + func (a AssetRequirement) IsHTML5Support() bool + func (a AssetRequirement) IsImageSupport() bool + func (a AssetRequirement) IsMain() bool + func (a AssetRequirement) IsMimeTypeSupport(mimePrefix string) bool + func (a AssetRequirement) IsMultiple() bool + func (a AssetRequirement) IsRequired() bool + func (a AssetRequirement) IsSoundSupport() bool + func (a AssetRequirement) IsVideoSupport() bool + func (a AssetRequirement) MatchesAspectRatio(width, height int) bool + func (a AssetRequirement) MaxSize(bytes int64) AssetRequirement + func (a AssetRequirement) MinMaxHeight() (mn, mx int) + func (a AssetRequirement) MinMaxWidth() (mn, mx int) + func (a AssetRequirement) RangeCount() (min, max int) + func (a AssetRequirement) Require() AssetRequirement + func (a AssetRequirement) RequireAltText(maxLength int) AssetRequirement + func (a AssetRequirement) Size(minW, maxW, minH, maxH int) AssetRequirement + func (a AssetRequirement) SoftEqual(asset AssetRequirement) bool + func (a AssetRequirement) Sound() AssetRequirement + func (a AssetRequirement) SupportsCodec(codec string) bool + func (a AssetRequirement) SupportsFramerate(fps float64) bool + func (a AssetRequirement) Types(types ...string) AssetRequirement + func (a AssetRequirement) When(c Condition) AssetRequirement + func (a AssetRequirement) WithAspectRatio(ratio string) AssetRequirement + func (a AssetRequirement) WithNavigateTo(screen string) AssetRequirement + func (a AssetRequirement) WithSafeZone(top, right, bottom, left float64) AssetRequirement + type Binding struct + Params map[string]any + Target string + func FindBinding(bindings []Binding, target string) (Binding, bool) + func NewBinding(target string, params any) Binding + type Condition struct + All []Condition + Any []Condition + Field string + In []any + Not *Condition + NotIn []any + Present *bool + func And(conds ...Condition) Condition + func FieldAbsent(field string) Condition + func FieldIn(field string, values ...any) Condition + func FieldNotIn(field string, values ...any) Condition + func FieldPresent(field string) Condition + func Not(c Condition) Condition + func Or(conds ...Condition) Condition + func (c Condition) Eval(values map[string]any) bool + func (c Condition) IsZero() bool + type Config struct + Children []Node + Condition *Condition + Entry bool + MaxCount int + MinCount int + Name string + Title string + func Group(name string) Config + func (c Config) ActiveAssets(values map[string]any) []AssetRequirement + func (c Config) ActiveFields(values map[string]any) []Field + func (c Config) ActiveGroups(values map[string]any) []Config + func (c Config) ActiveParams(values map[string]any) []Param + func (c Config) AsEntry() Config + func (c Config) AssetByName(name string) *AssetRequirement + func (c Config) Assets() []AssetRequirement + func (c Config) ContainsAsset(asset AssetRequirement, revers ...bool) bool + func (c Config) Count(min, max int) Config + func (c Config) EntryGroup() (Config, bool) + func (c Config) Fields() []Field + func (c Config) GetField(name string) *Field + func (c Config) GetMaxCount() int + func (c Config) GetMinCount() int + func (c Config) GetParam(name string) (Param, bool) + func (c Config) Groups() []Config + func (c Config) Intersec(other Config) bool + func (c Config) IsEmpty() bool + func (c Config) IsMultiple() bool + func (c Config) MainAsset() *AssetRequirement + func (c Config) Params() []Param + func (c Config) RangeCount() (min, max int) + func (c Config) RequiredField(fields ...string) *Field + func (c Config) RequiredFieldExcept(fields ...string) *Field + func (c Config) SimilarField(field Field, revers ...bool) *Field + func (c Config) SimpleAsset() *AssetRequirement + func (c Config) Validate() error + func (c Config) Walk(fn func(path string, n Node) error) error + func (c Config) When(cond Condition) Config + func (c Config) WithAssets(assets ...AssetRequirement) Config + func (c Config) WithFields(fields ...Field) Config + func (c Config) WithGroups(groups ...Config) Config + func (c Config) WithParams(params ...Param) Config + func (c Config) WithTitle(t string) Config + type Field struct + Bindings []Binding + Condition *Condition + Description string + Editable null.Bool + Mask string + Max float64 + MaxCount int + Min float64 + MinCount int + Multilang bool + Multiline int + Name string + NavigateTo string + Options []Option + RegExp string + Required bool + Title string + Type FieldType + func BoolField(name string) Field + func EmailField(name string) Field + func FloatField(name string) Field + func GeoField(name string) Field + func IntField(name string) Field + func PhoneField(name string) Field + func ScreenRefField(name string) Field + func StringField(name string) Field + func URLField(name string) Field + func (f Field) Bind(b Binding) Field + func (f Field) Count(min, max int) Field + func (f Field) GetMaxCount() int + func (f Field) GetMinCount() int + func (f Field) GetName() string + func (f Field) GetType() FieldType + func (f Field) HasOptions() bool + func (f Field) IsEditable() bool + func (f Field) IsMultilang() bool + func (f Field) IsMultiple() bool + func (f Field) IsRequired() bool + func (f Field) IsValidOption(v any) bool + func (f Field) Len(min, max int) Field + func (f Field) MaxLength() int + func (f Field) MultilineRows() int + func (f Field) Prepare(value any) (result any, err error) + func (f Field) Range(min, max float64) Field + func (f Field) RangeCount() (min, max int) + func (f Field) ReadOnly() Field + func (f Field) Require() Field + func (f Field) SoftEqual(field Field) bool + func (f Field) When(c Condition) Field + func (f Field) WithDescription(s string) Field + func (f Field) WithMask(mask string) Field + func (f Field) WithMultilang() Field + func (f Field) WithMultiline(rows int) Field + func (f Field) WithNavigateTo(screen string) Field + func (f Field) WithOptions(opts ...Option) Field + func (f Field) WithRegExp(pattern string) Field + func (f Field) WithTitle(t string) Field + type FieldType string + const FieldBoolType + const FieldDefaultType + const FieldEmailType + const FieldFloatType + const FieldGeoType + const FieldIntType + const FieldPhoneType + const FieldScreenRefType + const FieldStringType + const FieldURLType + type FocalPoint struct + Default [2]float64 + Enabled bool + type Format struct + Bindings []Binding + Codename string + Config *Config + ID uint64 + Kind Kind + Orientations []Orientation + Sizes []SizeOption + Tags []string + Title string + Version string + func DecodeAny(name string, data []byte) (*Format, error) + func LoadJSON(data []byte) (*Format, error) + func LoadYAML(data []byte) (*Format, error) + func ReadJSON(r io.Reader) (*Format, error) + func ReadYAML(r io.Reader) (*Format, error) + func (f *Format) GetConfig() *Config + func (f Format) DefaultSize() (SizeOption, bool) + func (f Format) HasTag(tag string) bool + func (f Format) IsAudio() bool + func (f Format) IsBanner() bool + func (f Format) IsDirect() bool + func (f Format) IsFixedSize() bool + func (f Format) IsNative() bool + func (f Format) IsPush() bool + func (f Format) IsVideo() bool + func (f Format) String() string + func (f Format) Suits(width, height int) bool + func (f Format) SupportsOrientation(o Orientation) bool + func (f Format) Validate() error + type GeoValue struct + Lat float64 + Lng float64 + func (g GeoValue) Validate() error + type Kind string + const KindAudio + const KindBanner + const KindCustom + const KindDirect + const KindNative + const KindPush + const KindVideo + func (k Kind) String() string + type Node struct + Asset *AssetRequirement + Field *Field + Group *Config + Kind NodeKind + Param *Param + func AssetNode(a AssetRequirement) Node + func FieldNode(f Field) Node + func GroupNode(c Config) Node + func ParamNode(p Param) Node + func (n Node) Condition() *Condition + func (n Node) IsActive(values map[string]any) bool + func (n Node) Name() string + func (n Node) NavigateTo() string + type NodeKind string + const NodeAsset + const NodeField + const NodeGroup + const NodeParam + type Option struct + Title string + Value any + func Opt(value any, title string) Option + type Orientation string + const OrientationLandscape + const OrientationPortrait + type Param struct + Condition *Condition + Name string + Value any + func NewParam(name string, value any) Param + func (p Param) GetName() string + func (p Param) When(c Condition) Param + type SafeZone struct + Bottom float64 + Left float64 + Right float64 + Top float64 + type SimpleAccessor struct + func NewSimpleAccessor(formats ...*Format) *SimpleAccessor + func (fa *SimpleAccessor) DirectFormatSet() *searchtypes.NumberBitset[uint] + func (fa *SimpleAccessor) FormatByCode(code string) *Format + func (fa *SimpleAccessor) FormatByID(id uint64) *Format + func (fa *SimpleAccessor) Formats() []*Format + func (fa *SimpleAccessor) FormatsBySize(width, height int) []*Format + func (fa *SimpleAccessor) Prepare() + type SizeOption struct + Default bool + Flexible bool + Height int + MaxHeight int + MaxWidth int + MinHeight int + MinWidth int + Title string + Width int + func FixedSize(title string, width, height int) SizeOption + func FlexibleSize(title string, minW, maxW, minH, maxH int) SizeOption + func (s SizeOption) AsDefault() SizeOption + func (s SizeOption) IsFixed() bool + func (s SizeOption) Suits(width, height int) bool + type Thumb struct + Height int + Width int