Documentation
¶
Index ¶
- Constants
- func DecodeBase64Export(data string) (string, error)
- type Base64Exporter
- type Base64Importer
- type DataLine
- type Detector
- type ExportRequest
- type ExportResult
- type Exporter
- type Format
- type ImportOptions
- type ImportResult
- type Importer
- type JSONLExporter
- type JSONLImporter
- type Metadata
- type ProviderData
- type ProviderImportInfo
Constants ¶
const ( // Base64Prefix is the prefix for Base64 format exports/imports Base64Prefix = "TGB64" // CurrentVersion is the current export format version CurrentVersion = "1.0" )
Variables ¶
This section is empty.
Functions ¶
func DecodeBase64Export ¶
DecodeBase64Export decodes a Base64 export back to JSONL content
Types ¶
type Base64Exporter ¶
type Base64Exporter struct {
// contains filtered or unexported fields
}
Base64Exporter exports data in Base64-encoded JSONL format
func NewBase64Exporter ¶
func NewBase64Exporter() *Base64Exporter
NewBase64Exporter creates a new Base64 exporter
func (*Base64Exporter) Export ¶
func (e *Base64Exporter) Export(req *ExportRequest) (*ExportResult, error)
Export performs the export in Base64 format
func (*Base64Exporter) Format ¶
func (e *Base64Exporter) Format() Format
Format returns the format type
type Base64Importer ¶
type Base64Importer struct {
// contains filtered or unexported fields
}
Base64Importer imports data from Base64-encoded JSONL format
func NewBase64Importer ¶
func NewBase64Importer() *Base64Importer
NewBase64Importer creates a new Base64 importer
func (*Base64Importer) Format ¶
func (i *Base64Importer) Format() Format
Format returns the format type
func (*Base64Importer) Import ¶
func (i *Base64Importer) Import(data string, globalConfig *config.Config, opts ImportOptions) (*ImportResult, error)
Import imports data from Base64 format
type DataLine ¶
type DataLine struct {
Type string `json:"type"`
}
DataLine is the base type for all data lines (export/import)
type ExportRequest ¶
ExportRequest contains the data needed for export
type ExportResult ¶
ExportResult represents the result of an export operation
func Export ¶
func Export(req *ExportRequest, format Format) (*ExportResult, error)
Export exports a rule with its providers in the specified format
type Exporter ¶
type Exporter interface {
Export(req *ExportRequest) (*ExportResult, error)
Format() Format
}
Exporter defines the interface for export implementations
func NewExporter ¶
NewExporter creates an exporter for the specified format
type ImportOptions ¶
type ImportOptions struct {
// OnProviderConflict specifies what to do when a provider already exists.
// "use" - use existing provider, "skip" - skip this provider, "suffix" - create with suffixed name
OnProviderConflict string
// Quiet suppresses progress output
Quiet bool
}
ImportOptions controls how imports are handled when conflicts occur
type ImportResult ¶
type ImportResult struct {
ProvidersCreated int
ProvidersUsed int
Providers []ProviderImportInfo
ProviderMap map[string]string // old UUID -> new UUID
}
ImportResult contains the results of an import operation
func Import ¶
func Import(data string, globalConfig *config.Config, format Format, opts ImportOptions) (*ImportResult, error)
Import imports a rule with providers from data in the specified format
type Importer ¶
type Importer interface {
Import(data string, globalConfig *config.Config, opts ImportOptions) (*ImportResult, error)
Format() Format
}
Importer defines the interface for import implementations
func NewImporter ¶
NewImporter creates an importer for the specified format
type JSONLExporter ¶
type JSONLExporter struct{}
JSONLExporter exports data in JSONL format
func NewJSONLExporter ¶
func NewJSONLExporter() *JSONLExporter
NewJSONLExporter creates a new JSONL exporter
func (*JSONLExporter) Export ¶
func (e *JSONLExporter) Export(req *ExportRequest) (*ExportResult, error)
Export performs the export in JSONL format
func (*JSONLExporter) Format ¶
func (e *JSONLExporter) Format() Format
Format returns the format type
type JSONLImporter ¶
type JSONLImporter struct{}
JSONLImporter imports data from JSONL format
func NewJSONLImporter ¶
func NewJSONLImporter() *JSONLImporter
NewJSONLImporter creates a new JSONL importer
func (*JSONLImporter) Format ¶
func (i *JSONLImporter) Format() Format
Format returns the format type
func (*JSONLImporter) Import ¶
func (i *JSONLImporter) Import(data string, globalConfig *config.Config, opts ImportOptions) (*ImportResult, error)
Import imports data from JSONL format
type Metadata ¶
type Metadata struct {
Type string `json:"type"`
Version string `json:"version"`
ExportedAt string `json:"exported_at"`
}
Metadata represents the metadata line (used for both export and import)
type ProviderData ¶
ProviderData represents the provider data (used for both export and import). It embeds typ.Provider directly so every field on the runtime Provider type automatically round-trips through export/import with no per-field mapping to maintain — adding a field to ai.Provider requires zero changes here. Because typ.Provider embeds without its own json tag, its fields promote to the same flat JSON level as Type, preserving the wire format (e.g. {"type":"provider","uuid":"...","name":"...",...}).
type ProviderImportInfo ¶
type ProviderImportInfo struct {
UUID string
Name string
Action string // "created", "used", "skipped"
}
ProviderImportInfo contains information about an imported or used provider