Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
// Required.
//
// ID is the stable component identifier used inside the bootstrap graph.
//
// RU: ID — стабильный идентификатор компонента внутри bootstrap-графа.
ID string
// Optional.
//
// Field overrides the generated Runtime field name.
// When empty, the runtime derives it from ID.
//
// RU: Field переопределяет имя поля в generated Runtime.
// Если поле пустое, runtime выводит его из ID.
Field string
// Required.
//
// Constructor points to the package-level constructor used to build the component.
// Must point to a package-level function.
//
// RU: Constructor указывает на package-level constructor, который создаёт компонент.
// Должно указывать на package-level функцию.
Constructor any
}
API describes one manually declared API component.
RU: API описывает один вручную объявленный API-компонент.
Required fields: ID, Constructor. Optional field: Field.
type Input ¶
type Input struct {
// Required.
// ID is the stable input identifier used inside the bootstrap graph.
// RU: ID — стабильный идентификатор input внутри bootstrap-графа.
ID string
// Optional.
// Field overrides the generated Runtime field name.
// When empty, the runtime derives it from ID.
// RU: Field переопределяет имя поля в generated Runtime.
// Если поле пустое, runtime выводит его из ID.
Field string
// Required.
// Prototype points to the input type prototype used for type resolution.
// Must point to the final input type.
// RU: Prototype указывает на прототип типа input для type-resolution.
// Должно указывать на итоговый input type.
Prototype any
// Optional.
// Prefix overrides the environment-variable prefix used to load the input.
// When empty, the runtime derives the env prefix from input ID.
// RU: Prefix переопределяет префикс env-переменных, используемый для загрузки input.
// Если поле пустое, runtime выводит env prefix из input ID.
Prefix string
// Optional.
// EnvPreset optionally points to an env preset type that should be loaded before conversion.
// Use together with Mapper or with default field-by-field conversion.
// RU: EnvPreset при необходимости указывает на тип env preset, который нужно загрузить до конверсии.
// Используется вместе с Mapper или с дефолтной field-by-field конверсией.
EnvPreset any
// Optional.
// Mapper optionally points to a preset-to-input mapper function.
// Requires EnvPreset.
// RU: Mapper при необходимости указывает на функцию преобразования preset -> input.
// Требует EnvPreset.
Mapper any
// Optional.
// Loader optionally points to a custom input loader function.
// Alternative to EnvPreset + Mapper.
// RU: Loader при необходимости указывает на кастомную функцию загрузки input.
// Альтернатива связке EnvPreset + Mapper.
Loader any
}
Input describes one manual input definition. RU: Input описывает одно ручное input-определение.
Required fields: ID, Prototype. Optional fields: Field, Prefix, EnvPreset, Mapper, Loader. Mapper requires EnvPreset. Loader cannot be combined with EnvPreset/Mapper. RU: Обязательные поля: ID, Prototype. RU: Опциональные поля: Field, Prefix, EnvPreset, Mapper, Loader. RU: Mapper требует EnvPreset. Loader нельзя комбинировать с EnvPreset/Mapper.
type Inventory ¶
type Inventory struct {
// Optional.
//
// Managed enables inventory expansion from Depsmith project bindings.
// When false, only manually declared APIs/Repos/URLs are used.
//
// RU: Managed включает разворачивание inventory из binding'ов Depsmith-проекта.
// Если false, используются только вручную объявленные APIs/Repos/URLs.
Managed bool
}
Inventory controls how bootstrap inventory is expanded. Use the zero value for fully manual inventory, or ManagedInventory() for project-managed expansion.
RU: Inventory управляет тем, как разворачивается bootstrap inventory. Используйте нулевое значение для полностью ручного inventory или ManagedInventory() для project-managed расширения.
func ManagedInventory ¶
func ManagedInventory() Inventory
ManagedInventory enables project-managed bootstrap inventory. Use it when API/repo inventory should be derived from Depsmith(root) bootstrap bindings.
RU: ManagedInventory включает project-managed bootstrap inventory. Используйте это, когда inventory API/repo должно выводиться из bootstrap binding'ов в Depsmith(root).
type Repo ¶
type Repo struct {
// Required.
//
// ID is the stable component identifier used inside the bootstrap graph.
//
// RU: ID — стабильный идентификатор компонента внутри bootstrap-графа.
ID string
// Optional.
//
// Field overrides the generated Runtime field name.
// When empty, the runtime derives it from ID.
//
// RU: Field переопределяет имя поля в generated Runtime.
// Если поле пустое, runtime выводит его из ID.
Field string
// Required.
//
// Constructor points to the package-level constructor used to build the component.
// Must point to a package-level function.
//
// RU: Constructor указывает на package-level constructor, который создаёт компонент.
// Должно указывать на package-level функцию.
Constructor any
}
Repo describes one manually declared repository component.
RU: Repo описывает один вручную объявленный repository-компонент.
Required fields: ID, Constructor. Optional field: Field.
type Spec ¶
type Spec struct {
// Optional.
//
// Inventory controls how API/repo/url inventory is sourced for this bootstrap.
// Zero value keeps inventory fully manual.
//
// RU: Inventory управляет тем, откуда берётся inventory API/repo/url для этого bootstrap.
// Нулевое значение оставляет inventory полностью ручным.
Inventory Inventory
// Optional.
//
// APIs lists manually declared API components.
//
// RU: APIs содержит вручную объявленные API-компоненты.
APIs []API
// Optional.
//
// Repos lists manually declared repository components.
//
// RU: Repos содержит вручную объявленные repository-компоненты.
Repos []Repo
// Optional.
//
// Steps lists manually declared step components.
//
// RU: Steps содержит вручную объявленные step-компоненты.
Steps []Step
// Optional.
//
// URLs lists manual URL definitions and overrides.
// Managed API inventory can also contribute URL definitions automatically.
//
// RU: URLs содержит ручные URL-определения и override-настройки.
// Managed inventory API также может автоматически добавлять URL-определения.
URLs []URL
// Optional.
//
// Inputs lists manual input definitions.
//
// RU: Inputs содержит ручные input-определения.
Inputs []Input
}
Spec describes one bootstrap definition authored in a Go package. RU: Spec описывает одну bootstrap-definition, которую пользователь пишет в Go package.
All sections are optional. Leave a slice empty to omit that section. RU: Все секции опциональны. Оставьте slice пустым, если секция не нужна.
type Step ¶
type Step struct {
// Optional.
//
// ID is the stable component identifier used inside the bootstrap graph.
// When empty, the runtime derives it from the step constructor package name.
//
// RU: ID — стабильный идентификатор компонента внутри bootstrap-графа.
// Если поле пустое, runtime выводит его из имени package у step constructor.
ID string
// Optional.
//
// Field overrides the generated Runtime field name.
// When empty, the runtime derives it from the effective step ID.
//
// RU: Field переопределяет имя поля в generated Runtime.
// Если поле пустое, runtime выводит его из итогового step ID.
Field string
// Required.
//
// Constructor points to the package-level step constructor.
// Supported signatures are func()..., func(Deps)..., func(context.Context)...,
// or func(context.Context, Deps)...
// RU: Constructor указывает на package-level constructor step-компонента.
// Поддерживаются сигнатуры func()..., func(Deps)...,
// func(context.Context)... и func(context.Context, Deps)...
Constructor any
// Required.
// URLs selects how string URL fields inside the step deps struct are resolved.
// Every step must set it, even when the step has no URL fields.
// Use URLsNone() when the step does not need URLs.
// RU: URLs выбирает, как резолвятся string URL-поля внутри step deps struct.
// Это поле обязательно для каждого step, даже если у step нет URL-полей.
// Используйте URLsNone(), если step не требует URL-зависимостей.
URLs URLStrategy
}
Step describes one manually declared step component.
RU: Step описывает один вручную объявленный step-компонент.
Required fields: Constructor, URLs. Optional fields: ID, Field.
type URL ¶
type URL struct {
// Required.
// ID is the stable URL identifier used inside the bootstrap graph.
// RU: ID — стабильный идентификатор URL внутри bootstrap-графа.
ID string
// Optional.
// Field overrides the generated Runtime field name.
// When empty, the runtime derives it from ID.
// RU: Field переопределяет имя поля в generated Runtime.
// Если поле пустое, runtime выводит его из ID.
Field string
// Optional.
// Prefix overrides the environment-variable prefix used to load the URL.
// When empty, the runtime derives the env prefix from URL ID.
// RU: Prefix переопределяет префикс env-переменных, используемый для загрузки URL.
// Если поле пустое, runtime выводит env prefix из URL ID.
Prefix string
}
URL describes one manual URL definition or override. RU: URL описывает одно ручное URL-определение или override.
Required field: ID. Optional fields: Field, Prefix. RU: Обязательное поле: ID. RU: Опциональные поля: Field, Prefix.
type URLBinding ¶
type URLBinding struct {
// Required.
//
// Field is the exported deps struct field name.
//
// RU: Field — имя exported-поля deps struct.
Field string
// Required.
//
// URLID is the target URL identifier from the bootstrap inventory.
// RU: URLID — целевой идентификатор URL из bootstrap inventory.
URLID string
}
URLBinding maps one exported deps-struct field to one URL ID. RU: URLBinding связывает одно exported-поле deps struct с одним URL ID.
Both fields are required in manual mode. RU: Оба поля обязательны в manual-режиме.
func BindURL ¶
func BindURL(field, urlID string) URLBinding
BindURL creates one explicit URL field binding.
RU: BindURL создаёт один явный binding URL-поля.
type URLMode ¶
type URLMode string
URLMode selects how step URL fields are resolved. RU: URLMode выбирает, как резолвятся URL-поля step-компонента.
const ( // URLModeNone declares that the step does not use URL fields at all. // RU: URLModeNone означает, что step вообще не использует URL-поля. URLModeNone URLMode = "none" // URLModeAuto resolves URL fields by naming convention. // RU: URLModeAuto резолвит URL-поля по naming convention. URLModeAuto URLMode = "auto" // URLModeManual resolves URL fields through explicit field-to-ID bindings. // RU: URLModeManual резолвит URL-поля через явные field-to-ID binding'и. URLModeManual URLMode = "manual" )
type URLStrategy ¶
type URLStrategy struct {
// Required.
// Mode selects the resolution strategy for URL fields.
// RU: Mode выбирает стратегию резолва URL-полей.
Mode URLMode
// Optional.
// Bindings lists explicit URL bindings used in manual mode.
// In manual mode, every URL field must be listed explicitly.
// RU: Bindings содержит явные URL-binding'и для manual-режима.
// В manual-режиме каждое URL-поле нужно перечислить явно.
Bindings []URLBinding
}
URLStrategy configures how URL fields inside one step deps struct are resolved. RU: URLStrategy настраивает, как резолвятся URL-поля внутри deps struct одного step.
Prefer constructing it through URLsNone(), URLsAuto() or URLsManual(...). RU: Предпочтительно создавать его через URLsNone(), URLsAuto() или URLsManual(...).
func URLsAuto ¶
func URLsAuto() URLStrategy
URLsAuto resolves URL fields by naming convention. Use it when deps struct fields like CatalogURL or CatalogBaseURL can be matched automatically.
RU: URLsAuto резолвит URL-поля по naming convention. Используйте это, когда поля deps struct вроде CatalogURL или CatalogBaseURL можно сопоставить автоматически.
func URLsManual ¶
func URLsManual(bindings ...URLBinding) URLStrategy
URLsManual resolves URL fields through explicit field-to-ID bindings. RU: URLsManual резолвит URL-поля через явные field-to-ID binding'и.
Use it when a step has multiple URL fields or non-conventional field names. RU: Используйте это, когда у step несколько URL-полей или нестандартные имена полей.
func URLsNone ¶
func URLsNone() URLStrategy
URLsNone declares that the step does not use URL fields. Use it for constructors whose deps struct has no string URL fields.
RU: URLsNone означает, что step не использует URL-поля. Используйте это для constructor'ов, у которых deps struct не содержит string URL-полей.