writers

package
v0.5.6 Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2023 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

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

Functions

func BuildPromptText

func BuildPromptText(rows [][]string) string

func ConvertServiceMapToArray

func ConvertServiceMapToArray(s map[int]model.Service,
	granularity string) [][]string

func ConvertServiceSliceToArray

func ConvertServiceSliceToArray(s []model.Service, granularity string) [][]string

func ConvertServiceToSlice

func ConvertServiceToSlice(s model.Service, granularity string) [][]string

func ConvertToCommaDelimitedString

func ConvertToCommaDelimitedString(rows [][]string) string

func ConvertToForecastStdoutType

func ConvertToForecastStdoutType(r model.ForecastPrintData,
	filteredBy string) model.ForecastStdoutType

func ConvertToStdoutType

func ConvertToStdoutType(s []model.Service,
	granularity string) model.CostAndUsageStdoutType

func CostAndUsageToCSV

func CostAndUsageToCSV(sortFn func(r map[int]model.Service) []model.Service,
	r model.CostAndUsageOutputType) error

func CostAndUsageToChart

func CostAndUsageToChart(sortFn func(r map[int]model.Service) []model.Service,
	r model.CostAndUsageOutputType) error

func CostAndUsageToOpenAI

func CostAndUsageToOpenAI(sortFn func(r map[int]model.Service) []model.Service,
	r model.CostAndUsageOutputType) error

func CostAndUsageToStdout

func CostAndUsageToStdout(sortFn func(r map[int]model.Service) []model.Service,
	r model.CostAndUsageOutputType) error

func CostUsageToRows

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

func CreateChatCompletionMessage

func CreateChatCompletionMessage(userMessage string) []gogpt.
	ChatCompletionMessage

func CreateSubTitle

func CreateSubTitle(granularity string, start string, end string) string

func CreateTitle

func CreateTitle(dimension string) string

func ForecastToRows

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

func ForecastToStdout

func ForecastToStdout(r model.ForecastPrintData,
	dimensions []string)

func MaxSupportedRows

func MaxSupportedRows(rows [][]string, maxRows int) int

func MetricsToService

func MetricsToService(m map[string]types.MetricValue) []model.Metrics

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) (model.Table, error)

func PopulatePieDate

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

func ResultsToServicesMap

func ResultsToServicesMap(res []types.ResultByTime) map[int]model.Service

func SortFunction

func SortFunction(sortBy string) func(r map[int]model.Service) []model.Service

func SortServicesByMetricAmount

func SortServicesByMetricAmount(r map[int]model.Service) []model.Service

func SortServicesByStartDate

func SortServicesByStartDate(r map[int]model.Service) []model.Service

func Summarize

func Summarize(apiKey string, userMessage string) (gogpt.ChatCompletionResponse,
	error)

func WriteToCSV

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

func WriteToChart

func WriteToChart(p *components.Page) error

func WriteToHTML

func WriteToHTML(completions string) error

Types

type Builder

type Builder struct {
}

func (Builder) NewCharts

func (Builder) NewCharts(r model.InputType) (*components.Page,
	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 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{})

Jump to

Keyboard shortcuts

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