writer

package
v0.7.4 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2024 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	OutputDir = "./writer"
)

Functions

func CostAndUsageToCSVMapper

func CostAndUsageToCSVMapper(sortFn func(r map[int]types.Service) []types.Service,
	r types.CostAndUsageOutputType) error

func CostAndUsageToChartMapper

func CostAndUsageToChartMapper(sortFn func(r map[int]types.Service) []types.Service,
	r types.CostAndUsageOutputType) error

func CostAndUsageToStdoutMapper

func CostAndUsageToStdoutMapper(sortFn func(r map[int]types.Service) []types.Service,
	r types.CostAndUsageOutputType) error

func CostAndUsageToVectorMapper

func CostAndUsageToVectorMapper(r types.CostAndUsageOutputType) error

func CostUsageToRows

func CostUsageToRows(s []types.Service, granularity string) types.CostAndUsage

func CreateTitle

func CreateTitle(dimension string) string

func ForecastToRows

func ForecastToRows(r types.ForecastStdoutType) []table.Row

func ForecastToStdoutMapper

func ForecastToStdoutMapper(r types.ForecastPrintData,
	dimensions []string)

func NewCSVFile

func NewCSVFile(dir string, file string) (*os.File, error)

func NewCSVWriter

func NewCSVWriter(f io.Writer, header []string) (*csv.Writer, error)

func NewStdoutWriter

func NewStdoutWriter(variant string) (types.Table, error)

func PopulatePieDate

func PopulatePieDate(services []types.Service, key int) []opts.
	PieData

func WriteToCSV

func WriteToCSV(f *os.File, header []string, rows [][]string) error

func WriteToChart

func WriteToChart(p *components.Page) error

Types

type Builder

type Builder struct {
}

func (Builder) NewCharts

func (Builder) NewCharts(r types.InputType) (*components.Page,
	error)

type ChartPrinter

type ChartPrinter struct {
	Variant string
}

func (*ChartPrinter) Write

func (p *ChartPrinter) Write(f interface{}, c interface{}) error

type CostAndUsageTable

type CostAndUsageTable struct {
	Table table.Writer
}

func (CostAndUsageTable) AddRows

func (c CostAndUsageTable) AddRows(rows []table.Row)

func (CostAndUsageTable) Footer

func (c CostAndUsageTable) Footer(row table.Row)

func (CostAndUsageTable) Header

func (c CostAndUsageTable) Header()

func (CostAndUsageTable) Style

func (c CostAndUsageTable) Style()

func (CostAndUsageTable) Writer

func (c CostAndUsageTable) Writer(output interface{})

type CsvPrinter

type CsvPrinter struct {
	Variant string
}

func (*CsvPrinter) Write

func (p *CsvPrinter) Write(f interface{}, c interface{}) error

type ForecastTable

type ForecastTable struct {
	Table table.Writer
}

func (ForecastTable) AddRows

func (f ForecastTable) AddRows(rows []table.Row)

func (ForecastTable) Footer

func (f ForecastTable) Footer(row table.Row)

func (ForecastTable) Header

func (f ForecastTable) Header()

func (ForecastTable) Style

func (f ForecastTable) Style()

func (ForecastTable) Writer

func (f ForecastTable) Writer(output interface{})

type OpenAIPrinter

type OpenAIPrinter struct {
	Variant string
}

type PineconePrinter

type PineconePrinter struct {
	Variant string
}

func (*PineconePrinter) Write

func (p *PineconePrinter) Write(f interface{}, c interface{}) error

type Printer

type Printer interface {
	Write(interface{}, interface{}) error
}

func NewPrintWriter

func NewPrintWriter(printType types.PrintWriterType, variant string) Printer

type StdoutPrinter

type StdoutPrinter struct {
	Variant string
}

func (*StdoutPrinter) Write

func (p *StdoutPrinter) Write(f interface{}, c interface{}) error

type VectorStore

type VectorStore interface {
	CreateVectorStoreInput(r types.CostAndUsageOutputType) ([]*types.VectorStoreItem, error)
	CreateEmbeddings(items []*types.VectorStoreItem) ([]gogpt.Embedding, error)
	Upsert(context context.Context, data []pinecone2.PineconeStruct) (resp types.UpsertResponse, err error)
}

func NewVectorStoreClient

func NewVectorStoreClient(builder http.Builder, openAIAPIKey,
	indexUrl,
	pineconeAPIKey string) VectorStore

type VectorStoreClient

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

func (*VectorStoreClient) CreateEmbeddings

func (v *VectorStoreClient) CreateEmbeddings(items []*types.VectorStoreItem) (
	[]gogpt.Embedding,
	error)

func (*VectorStoreClient) CreateVectorStoreInput

func (v *VectorStoreClient) CreateVectorStoreInput(r types.CostAndUsageOutputType) ([]*types.VectorStoreItem, error)

func (*VectorStoreClient) Upsert

func (v *VectorStoreClient) Upsert(context context.Context,
	items []pinecone2.PineconeStruct) (resp types.UpsertResponse, err error)

Jump to

Keyboard shortcuts

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