source

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2025 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrColumnNameOrIdEmpty

func ErrColumnNameOrIdEmpty() error

func ErrColumnNotFound

func ErrColumnNotFound(input string) error

func ErrTableNameOrIdEmpty

func ErrTableNameOrIdEmpty() error

func ErrTableNotFound

func ErrTableNotFound(input string) error

Types

type AISource

type AISource struct {
	BasicSource
	Prompt  string   `json:"prompt"`
	Options []string `json:"options"`
}

func (*AISource) Init

func (as *AISource) Init(ctx context.Context, aiSrv ai.AiService, column *ent.TableColumn, model string) error

func (*AISource) Next

func (as *AISource) Next(ctx context.Context, idx int) (*schema.CellValue, error)

func (*AISource) Total

func (as *AISource) Total() int

type BasicSource

type BasicSource struct {
	Name string `json:"name"`
	Type string `json:"type"`
}

type CsvSource

type CsvSource struct {
	BasicSource
	RandomCSV      *csvindexer.CSVIndexer
	Paths          []string `json:"paths"`
	Kaggle         string   `json:"kaggle"`
	Column         string   `json:"column"`
	ContextColumns []string `json:"context_columns"`
}

func (*CsvSource) GetColumns

func (cs *CsvSource) GetColumns(ctx context.Context, logger *zap.SugaredLogger, dir string) ([]string, error)

func (*CsvSource) GetLinkedCellValue

func (cs *CsvSource) GetLinkedCellValue(row []any, column string, contextColumns []string) *schema.CellValue

func (*CsvSource) Init

func (cs *CsvSource) Init(ctx context.Context, logger *zap.SugaredLogger, dir string) error

func (*CsvSource) Next

func (cs *CsvSource) Next(ctx context.Context, idx int) (*schema.CellValue, error)

func (*CsvSource) NextLinked

func (cs *CsvSource) NextLinked(ctx context.Context, idx int, column string, contextColumns []string) (*schema.CellValue, error)

func (*CsvSource) Range

func (cs *CsvSource) Range(fn func(row []any) bool) error

func (*CsvSource) Total

func (cs *CsvSource) Total() int

type FilesSource

type FilesSource struct {
	BasicSource
	Paths []string `json:"paths"`
	Files []string
}

func (*FilesSource) Init

func (f *FilesSource) Init(ctx context.Context, logger *zap.SugaredLogger, dir string) error

func (*FilesSource) Next

func (f *FilesSource) Next(ctx context.Context, idx int) (*schema.CellValue, error)

func (*FilesSource) Total

func (f *FilesSource) Total() int

type Huggingface

type Huggingface struct {
	Dataset string `json:"dataset"`
	Config  string `json:"config"`
	Split   string `json:"split"`
	// contains filtered or unexported fields
}

type Indexer

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

func NewIndexer

func NewIndexer(source Source, column *ent.TableColumn) *Indexer

func (*Indexer) Next

func (i *Indexer) Next(ctx context.Context) (*schema.CellValue, error)

type InvalidSource

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

func (*InvalidSource) Error

func (e *InvalidSource) Error() string

type LinkedSource

type LinkedSource struct {
	BasicSource

	Table string `json:"table"`
	// contains filtered or unexported fields
}

func (*LinkedSource) GetLinkedCellValue

func (ls *LinkedSource) GetLinkedCellValue(row *ent.TableRow, column string, contextColumns []string) *schema.CellValue

func (*LinkedSource) Init

func (ls *LinkedSource) Init(ctx context.Context, db *ent.Client) error

func (*LinkedSource) Next

func (ls *LinkedSource) Next(ctx context.Context, idx int) (*schema.CellValue, error)

func (*LinkedSource) NextLinked

func (ls *LinkedSource) NextLinked(ctx context.Context, idx int, column string, contextColumns []string) (*schema.CellValue, error)

func (*LinkedSource) Range

func (ls *LinkedSource) Range(fn func(row *ent.TableRow) bool)

func (*LinkedSource) Total

func (ls *LinkedSource) Total() int

type ListSource

type ListSource struct {
	BasicSource
	Options []string `json:"options"`
	File    string   `json:"file,omitempty"`
}

func (*ListSource) Init

func (ls *ListSource) Init(ctx context.Context, dir string) error

func (*ListSource) Next

func (ls *ListSource) Next(ctx context.Context, idx int) (*schema.CellValue, error)

func (*ListSource) Total

func (ls *ListSource) Total() int

type ParquetSource

type ParquetSource struct {
	BasicSource

	Paths          []string `json:"paths"`
	Column         string   `json:"column"`
	ContextColumns []string `json:"context_columns"`
	Huggingface    *Huggingface
	// contains filtered or unexported fields
}

func (*ParquetSource) GetColumns

func (ps *ParquetSource) GetColumns(ctx context.Context, logger *zap.SugaredLogger, dir string) ([]string, error)

func (*ParquetSource) GetLinkedCellValue

func (ps *ParquetSource) GetLinkedCellValue(row map[string]any, column string, contextColumns []string) *schema.CellValue

func (*ParquetSource) Init

func (ps *ParquetSource) Init(ctx context.Context, hfClient huggingface.Client, logger *zap.SugaredLogger, dir string) error

func (*ParquetSource) Next

func (ps *ParquetSource) Next(ctx context.Context, idx int) (*schema.CellValue, error)

func (*ParquetSource) NextLinked

func (ps *ParquetSource) NextLinked(ctx context.Context, idx int, column string, contextColumns []string) (*schema.CellValue, error)

func (*ParquetSource) Range

func (ps *ParquetSource) Range(ctx context.Context, fn func(row map[string]any) bool) error

func (*ParquetSource) Total

func (ps *ParquetSource) Total() int

type Source

type Source interface {
	Next(ctx context.Context, idx int) (*schema.CellValue, error)
	Total() int
}

func ValidateSource

func ValidateSource(ctx context.Context, raw json.RawMessage, db *ent.Client) (Source, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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