Documentation
¶
Index ¶
- Constants
- type AIRowsGenerator
- type ColumnSchema
- type GenerateRowsParams
- type ListTablesResponse
- type Rows
- type RowsGenerator
- type RowsGeneratorMock
- type TableColumnInfo
- type TableGenColumn
- type TableGenColumnSchema
- type TableGenRequest
- type TableInfoSimple
- type TableService
- type TableServiceImpl
- func (t *TableServiceImpl) CreateTable(ctx context.Context, req *TableGenRequest) (string, error)
- func (t *TableServiceImpl) Delete(ctx context.Context, table string) (int, error)
- func (t *TableServiceImpl) Genetate(ctx context.Context, params GenerateRowsParams) (RowsGenerator, error)
- func (t *TableServiceImpl) GetTableColumns(ctx context.Context, table string) ([]TableColumnInfo, error)
- func (t *TableServiceImpl) Import(ctx context.Context, table string, reader io.Reader) (string, error)
- func (t *TableServiceImpl) ListTables(ctx context.Context) (*ListTablesResponse, error)
- func (t *TableServiceImpl) Rows(ctx context.Context, table string) (*Rows, error)
- func (t *TableServiceImpl) Truncate(ctx context.Context, table string) (int, error)
- type TableServiceMock
- func (mock *TableServiceMock) CreateTable(ctx context.Context, req *TableGenRequest) (string, error)
- func (mock *TableServiceMock) CreateTableCalls() []struct{ ... }
- func (mock *TableServiceMock) Delete(ctx context.Context, table string) (int, error)
- func (mock *TableServiceMock) DeleteCalls() []struct{ ... }
- func (mock *TableServiceMock) Genetate(ctx context.Context, params GenerateRowsParams) (RowsGenerator, error)
- func (mock *TableServiceMock) GenetateCalls() []struct{ ... }
- func (mock *TableServiceMock) GetTableColumns(ctx context.Context, table string) ([]TableColumnInfo, error)
- func (mock *TableServiceMock) GetTableColumnsCalls() []struct{ ... }
- func (mock *TableServiceMock) Import(ctx context.Context, table string, reader io.Reader) (string, error)
- func (mock *TableServiceMock) ImportCalls() []struct{ ... }
- func (mock *TableServiceMock) ListTables(ctx context.Context) (*ListTablesResponse, error)
- func (mock *TableServiceMock) ListTablesCalls() []struct{ ... }
- func (mock *TableServiceMock) Rows(ctx context.Context, table string) (*Rows, error)
- func (mock *TableServiceMock) RowsCalls() []struct{ ... }
- func (mock *TableServiceMock) Truncate(ctx context.Context, table string) (int, error)
- func (mock *TableServiceMock) TruncateCalls() []struct{ ... }
Constants ¶
const ( CREATE_TABLE_TEMPERATURE = 0.1 CREATE_TABLE_MAX_TOKENS = 3000 GENERATE_DATA_TEMPERATURE = 0.6 GENERATE_DATA_MAX_TOKENS = 6000 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AIRowsGenerator ¶
type AIRowsGenerator struct {
// contains filtered or unexported fields
}
func NewRowsGenerator ¶
func NewRowsGenerator(ctx context.Context, params GenerateRowsParams, db *ent.Client, ai ai.AiService, logger *zap.SugaredLogger) (*AIRowsGenerator, error)
func (*AIRowsGenerator) Table ¶
func (g *AIRowsGenerator) Table() *ent.TableMeta
type ColumnSchema ¶
type GenerateRowsParams ¶
type ListTablesResponse ¶
type ListTablesResponse struct {
Total int
Tables []TableInfoSimple
}
type RowsGenerator ¶
type RowsGeneratorMock ¶
type RowsGeneratorMock struct {
// NextFunc mocks the Next method.
NextFunc func(ctx context.Context) ([]map[string]*schema.CellValue, error)
// TableFunc mocks the Table method.
TableFunc func() *ent.TableMeta
// contains filtered or unexported fields
}
RowsGeneratorMock is a mock implementation of RowsGenerator.
func TestSomethingThatUsesRowsGenerator(t *testing.T) {
// make and configure a mocked RowsGenerator
mockedRowsGenerator := &RowsGeneratorMock{
NextFunc: func(ctx context.Context) ([]map[string]*schema.CellValue, error) {
panic("mock out the Next method")
},
TableFunc: func() *ent.TableMeta {
panic("mock out the Table method")
},
}
// use mockedRowsGenerator in code that requires RowsGenerator
// and then make assertions.
}
func (*RowsGeneratorMock) NextCalls ¶
func (mock *RowsGeneratorMock) NextCalls() []struct { Ctx context.Context }
NextCalls gets all the calls that were made to Next. Check the length with:
len(mockedRowsGenerator.NextCalls())
func (*RowsGeneratorMock) Table ¶
func (mock *RowsGeneratorMock) Table() *ent.TableMeta
Table calls TableFunc.
func (*RowsGeneratorMock) TableCalls ¶
func (mock *RowsGeneratorMock) TableCalls() []struct { }
TableCalls gets all the calls that were made to Table. Check the length with:
len(mockedRowsGenerator.TableCalls())
type TableColumnInfo ¶
type TableGenColumn ¶
type TableGenColumnSchema ¶
type TableGenRequest ¶
type TableGenRequest struct {
Name string `json:"name"`
Model string `json:"model"`
Description string `json:"description"`
Columns []TableGenColumn `json:"columns"`
Sources []json.RawMessage `json:"sources"`
}
type TableInfoSimple ¶
type TableService ¶
type TableService interface {
CreateTable(ctx context.Context, req *TableGenRequest) (string, error)
ListTables(ctx context.Context) (*ListTablesResponse, error)
GetTableColumns(ctx context.Context, table string) ([]TableColumnInfo, error)
Genetate(ctx context.Context, params GenerateRowsParams) (RowsGenerator, error)
Rows(ctx context.Context, table string) (*Rows, error)
Truncate(ctx context.Context, table string) (int, error)
Delete(ctx context.Context, table string) (int, error)
Import(ctx context.Context, table string, reader io.Reader) (string, error)
}
type TableServiceImpl ¶
type TableServiceImpl struct {
// contains filtered or unexported fields
}
func NewTableService ¶
func NewTableService(config *config.Config, db *ent.Client, ai ai.AiService, logger *zap.SugaredLogger) *TableServiceImpl
func (*TableServiceImpl) CreateTable ¶
func (t *TableServiceImpl) CreateTable(ctx context.Context, req *TableGenRequest) (string, error)
func (*TableServiceImpl) Genetate ¶
func (t *TableServiceImpl) Genetate(ctx context.Context, params GenerateRowsParams) (RowsGenerator, error)
func (*TableServiceImpl) GetTableColumns ¶
func (t *TableServiceImpl) GetTableColumns(ctx context.Context, table string) ([]TableColumnInfo, error)
func (*TableServiceImpl) ListTables ¶
func (t *TableServiceImpl) ListTables(ctx context.Context) (*ListTablesResponse, error)
type TableServiceMock ¶
type TableServiceMock struct {
// CreateTableFunc mocks the CreateTable method.
CreateTableFunc func(ctx context.Context, req *TableGenRequest) (string, error)
// DeleteFunc mocks the Delete method.
DeleteFunc func(ctx context.Context, table string) (int, error)
// GenetateFunc mocks the Genetate method.
GenetateFunc func(ctx context.Context, params GenerateRowsParams) (RowsGenerator, error)
// GetTableColumnsFunc mocks the GetTableColumns method.
GetTableColumnsFunc func(ctx context.Context, table string) ([]TableColumnInfo, error)
// ImportFunc mocks the Import method.
ImportFunc func(ctx context.Context, table string, reader io.Reader) (string, error)
// ListTablesFunc mocks the ListTables method.
ListTablesFunc func(ctx context.Context) (*ListTablesResponse, error)
// RowsFunc mocks the Rows method.
RowsFunc func(ctx context.Context, table string) (*Rows, error)
// TruncateFunc mocks the Truncate method.
TruncateFunc func(ctx context.Context, table string) (int, error)
// contains filtered or unexported fields
}
TableServiceMock is a mock implementation of TableService.
func TestSomethingThatUsesTableService(t *testing.T) {
// make and configure a mocked TableService
mockedTableService := &TableServiceMock{
CreateTableFunc: func(ctx context.Context, req *TableGenRequest) (string, error) {
panic("mock out the CreateTable method")
},
DeleteFunc: func(ctx context.Context, table string) (int, error) {
panic("mock out the Delete method")
},
GenetateFunc: func(ctx context.Context, params GenerateRowsParams) (RowsGenerator, error) {
panic("mock out the Genetate method")
},
GetTableColumnsFunc: func(ctx context.Context, table string) ([]TableColumnInfo, error) {
panic("mock out the GetTableColumns method")
},
ImportFunc: func(ctx context.Context, table string, reader io.Reader) (string, error) {
panic("mock out the Import method")
},
ListTablesFunc: func(ctx context.Context) (*ListTablesResponse, error) {
panic("mock out the ListTables method")
},
RowsFunc: func(ctx context.Context, table string) (*Rows, error) {
panic("mock out the Rows method")
},
TruncateFunc: func(ctx context.Context, table string) (int, error) {
panic("mock out the Truncate method")
},
}
// use mockedTableService in code that requires TableService
// and then make assertions.
}
func (*TableServiceMock) CreateTable ¶
func (mock *TableServiceMock) CreateTable(ctx context.Context, req *TableGenRequest) (string, error)
CreateTable calls CreateTableFunc.
func (*TableServiceMock) CreateTableCalls ¶
func (mock *TableServiceMock) CreateTableCalls() []struct { Ctx context.Context Req *TableGenRequest }
CreateTableCalls gets all the calls that were made to CreateTable. Check the length with:
len(mockedTableService.CreateTableCalls())
func (*TableServiceMock) DeleteCalls ¶
func (mock *TableServiceMock) DeleteCalls() []struct { Ctx context.Context Table string }
DeleteCalls gets all the calls that were made to Delete. Check the length with:
len(mockedTableService.DeleteCalls())
func (*TableServiceMock) Genetate ¶
func (mock *TableServiceMock) Genetate(ctx context.Context, params GenerateRowsParams) (RowsGenerator, error)
Genetate calls GenetateFunc.
func (*TableServiceMock) GenetateCalls ¶
func (mock *TableServiceMock) GenetateCalls() []struct { Ctx context.Context Params GenerateRowsParams }
GenetateCalls gets all the calls that were made to Genetate. Check the length with:
len(mockedTableService.GenetateCalls())
func (*TableServiceMock) GetTableColumns ¶
func (mock *TableServiceMock) GetTableColumns(ctx context.Context, table string) ([]TableColumnInfo, error)
GetTableColumns calls GetTableColumnsFunc.
func (*TableServiceMock) GetTableColumnsCalls ¶
func (mock *TableServiceMock) GetTableColumnsCalls() []struct { Ctx context.Context Table string }
GetTableColumnsCalls gets all the calls that were made to GetTableColumns. Check the length with:
len(mockedTableService.GetTableColumnsCalls())
func (*TableServiceMock) Import ¶
func (mock *TableServiceMock) Import(ctx context.Context, table string, reader io.Reader) (string, error)
Import calls ImportFunc.
func (*TableServiceMock) ImportCalls ¶
func (mock *TableServiceMock) ImportCalls() []struct { Ctx context.Context Table string Reader io.Reader }
ImportCalls gets all the calls that were made to Import. Check the length with:
len(mockedTableService.ImportCalls())
func (*TableServiceMock) ListTables ¶
func (mock *TableServiceMock) ListTables(ctx context.Context) (*ListTablesResponse, error)
ListTables calls ListTablesFunc.
func (*TableServiceMock) ListTablesCalls ¶
func (mock *TableServiceMock) ListTablesCalls() []struct { Ctx context.Context }
ListTablesCalls gets all the calls that were made to ListTables. Check the length with:
len(mockedTableService.ListTablesCalls())
func (*TableServiceMock) RowsCalls ¶
func (mock *TableServiceMock) RowsCalls() []struct { Ctx context.Context Table string }
RowsCalls gets all the calls that were made to Rows. Check the length with:
len(mockedTableService.RowsCalls())
func (*TableServiceMock) TruncateCalls ¶
func (mock *TableServiceMock) TruncateCalls() []struct { Ctx context.Context Table string }
TruncateCalls gets all the calls that were made to Truncate. Check the length with:
len(mockedTableService.TruncateCalls())