dataexport

package
v0.260409.1540 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2026 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Base64Prefix is the prefix for Base64 format exports
	Base64Prefix = "TGB64"
	// CurrentVersion is the current export format version
	CurrentVersion = "1.0"
)

Variables

This section is empty.

Functions

func DecodeBase64Export

func DecodeBase64Export(data string) (string, error)

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 ExportLine

type ExportLine struct {
	Type string `json:"type"`
}

ExportLine is the base type for all export lines

type ExportMetadata

type ExportMetadata struct {
	Type       string `json:"type"`
	Version    string `json:"version"`
	ExportedAt string `json:"exported_at"`
}

ExportMetadata represents the metadata line

type ExportProviderData

type ExportProviderData struct {
	Type        string           `json:"type"`
	UUID        string           `json:"uuid"`
	Name        string           `json:"name"`
	APIBase     string           `json:"api_base"`
	APIStyle    string           `json:"api_style"`
	AuthType    string           `json:"auth_type"`
	Token       string           `json:"token"`
	OAuthDetail *typ.OAuthDetail `json:"oauth_detail"`
	Enabled     bool             `json:"enabled"`
	ProxyURL    string           `json:"proxy_url"`
	Timeout     int64            `json:"timeout"`
	Tags        []string         `json:"tags"`
	Models      []string         `json:"models"`
}

ExportProviderData represents the provider export data

type ExportRequest

type ExportRequest struct {
	Rule      *typ.Rule
	Providers []*typ.Provider
}

ExportRequest contains the data needed for export

type ExportResult

type ExportResult struct {
	Format  Format
	Content string
}

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 ExportRuleData

type ExportRuleData struct {
	Type          string                 `json:"type"`
	UUID          string                 `json:"uuid"`
	Scenario      string                 `json:"scenario"`
	RequestModel  string                 `json:"request_model"`
	ResponseModel string                 `json:"response_model"`
	Description   string                 `json:"description"`
	Services      []*loadbalance.Service `json:"services"`
	LBTactic      typ.Tactic             `json:"lb_tactic"`
	Active        bool                   `json:"active"`
	SmartEnabled  bool                   `json:"smart_enabled"`
	SmartRouting  []interface{}          `json:"smart_routing"`
}

ExportRuleData represents the rule export data

type Exporter

type Exporter interface {
	Export(req *ExportRequest) (*ExportResult, error)
	Format() Format
}

Exporter defines the interface for export implementations

func NewExporter

func NewExporter(format Format) (Exporter, error)

NewExporter creates an exporter for the specified format

type Format

type Format string

Format represents the export format type

const (
	// FormatJSONL is the line-delimited JSON format
	FormatJSONL Format = "jsonl"
	// FormatBase64 is the Base64-encoded JSONL format
	FormatBase64 Format = "base64"
)

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

Jump to

Keyboard shortcuts

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