Documentation ¶
Index ¶
- Variables
- func GetMemoryUsage() int
- func NewClientMetaRuntime(ctx context.Context, workspace, providerName, providerVersion string, ...) (runtime *ClientMetaRuntime, diagnostics *Diagnostics)
- func NewDataSourcePullExecutor(workerNum uint64, clientMeta *ClientMeta, errorsHandlerMeta *ErrorsHandlerMeta) (*DataSourceExecutor, *Diagnostics)
- type ClientLogger
- type ClientMeta
- func (x *ClientMeta) ClearItem()
- func (x *ClientMeta) GetClientSlice() []any
- func (x *ClientMeta) GetIntItem(itemName string, defaultValue int) int
- func (x *ClientMeta) GetItem(itemName string) any
- func (x *ClientMeta) GetStringItem(itemName, defaultValue string) string
- func (x *ClientMeta) Runtime() *ClientMetaRuntime
- func (x *ClientMeta) SetItem(itemName string, itemValue any)
- type ClientMetaRuntime
- func (x *ClientMetaRuntime) ClearItem()
- func (x *ClientMetaRuntime) GetIntItem(itemName string, defaultValue int) int
- func (x *ClientMetaRuntime) GetItem(itemName string) any
- func (x *ClientMetaRuntime) GetStringItem(itemName, defaultValue string) string
- func (x *ClientMetaRuntime) SetItem(itemName string, itemValue any)
- type ClientTaskContext
- type Column
- type ColumnOptions
- type ColumnRuntime
- type ColumnType
- type ColumnValueConvertor
- type ColumnValueExtractor
- type ConsumerSemaphore
- type DataSource
- type DataSourceExecutor
- type DataSourcePullTask
- func (x *DataSourcePullTask) ClearItem()
- func (x *DataSourcePullTask) Clone() *DataSourcePullTask
- func (x *DataSourcePullTask) GetIntItem(itemName string, defaultValue int) int
- func (x *DataSourcePullTask) GetItem(itemName string) any
- func (x *DataSourcePullTask) GetStringItem(itemName, defaultValue string) string
- func (x *DataSourcePullTask) LookupIntItem(itemName string, defaultValue int) int
- func (x *DataSourcePullTask) LookupItem(itemName string) any
- func (x *DataSourcePullTask) LookupStringItem(itemName, defaultValue string) string
- func (x *DataSourcePullTask) SetItem(itemName string, itemValue any)
- type DataSourcePullTaskQueue
- type DefaultClientLogger
- func (x *DefaultClientLogger) Debug(msg string, fields ...zap.Field)
- func (x *DefaultClientLogger) DebugF(msg string, args ...any)
- func (x *DefaultClientLogger) Error(msg string, fields ...zap.Field)
- func (x *DefaultClientLogger) ErrorF(msg string, args ...any)
- func (x *DefaultClientLogger) Fatal(msg string, fields ...zap.Field)
- func (x *DefaultClientLogger) FatalF(msg string, args ...any)
- func (x *DefaultClientLogger) Info(msg string, fields ...zap.Field)
- func (x *DefaultClientLogger) InfoF(msg string, args ...any)
- func (x *DefaultClientLogger) Log(level zapcore.Level, msg string, fields ...zap.Field)
- func (x *DefaultClientLogger) LogDiagnostics(prefix string, d *Diagnostics)
- func (x *DefaultClientLogger) Name() string
- func (x *DefaultClientLogger) Warn(msg string, fields ...zap.Field)
- func (x *DefaultClientLogger) WarnF(msg string, args ...any)
- type DefaultClientLoggerConfig
- func (x *DefaultClientLoggerConfig) EncodeLevel() zapcore.LevelEncoder
- func (x *DefaultClientLoggerConfig) GetEncoder() zapcore.Encoder
- func (x *DefaultClientLoggerConfig) GetEncoderConfig() zapcore.EncoderConfig
- func (x *DefaultClientLoggerConfig) GetEncoderCore() []zapcore.Core
- func (x *DefaultClientLoggerConfig) GetLevelPriority(level zapcore.Level) zap.LevelEnablerFunc
- func (x *DefaultClientLoggerConfig) GetLogWriter(level string) zapcore.WriteSyncer
- func (x *DefaultClientLoggerConfig) TranslationLevel() zapcore.Level
- type DesensitizationFunction
- type Diagnostic
- type DiagnosticLevel
- type Diagnostics
- func NewDiagnostics() *Diagnostics
- func NewDiagnosticsAddErrorMsg(format string, args ...any) *Diagnostics
- func NewDiagnosticsErrorColumnValueExtractor(table *Table, column *Column, err error) *Diagnostics
- func NewDiagnosticsErrorMsgColumnValueExtractor(table *Table, column *Column, format string, args ...any) *Diagnostics
- func NewDiagnosticsErrorMsgPullTable(table *Table, format string, args ...any) *Diagnostics
- func NewDiagnosticsErrorPullTable(table *Table, err error) *Diagnostics
- func (x *Diagnostics) Add(d any) *Diagnostics
- func (x *Diagnostics) AddDiagnostic(diagnostic *Diagnostic) *Diagnostics
- func (x *Diagnostics) AddDiagnostics(diagnostics *Diagnostics) *Diagnostics
- func (x *Diagnostics) AddError(err error) *Diagnostics
- func (x *Diagnostics) AddErrorColumnValueExtractor(table *Table, column *Column, err error) *Diagnostics
- func (x *Diagnostics) AddErrorMsg(format string, args ...any) *Diagnostics
- func (x *Diagnostics) AddErrorMsgColumnValueExtractor(table *Table, column *Column, format string, args ...any) *Diagnostics
- func (x *Diagnostics) AddErrorMsgPullTable(table *Table, format string, args ...any) *Diagnostics
- func (x *Diagnostics) AddErrorPullTable(table *Table, err error) *Diagnostics
- func (x *Diagnostics) AddFatal(format string, args ...any) *Diagnostics
- func (x *Diagnostics) AddInfo(format string, args ...any) *Diagnostics
- func (x *Diagnostics) AddWarn(format string, args ...any) *Diagnostics
- func (x *Diagnostics) GetDiagnosticSlice() []*Diagnostic
- func (x *Diagnostics) HasError() bool
- func (x *Diagnostics) IsEmpty() bool
- func (x *Diagnostics) Size() int
- func (x *Diagnostics) String() string
- func (x *Diagnostics) ToString() string
- type ErrorsHandlerMeta
- type ErrorsHandlerMetaRuntime
- type IgnoredError
- type Row
- func (x *Row) AddColumnName(columnName string) error
- func (x *Row) AddColumnNames(columnNames []string) error
- func (x *Row) ColumnCount() int
- func (x *Row) Get(columnName string) (any, error)
- func (x *Row) GetColumnNames() []string
- func (x *Row) GetInt(columnName string) (int, error)
- func (x *Row) GetIntOrDefault(columnName string, defaultValue int) int
- func (x *Row) GetOrDefault(columnName string, defaultValue any) any
- func (x *Row) GetString(columnName string) (string, error)
- func (x *Row) GetStringOrDefault(columnName, defaultValue string) string
- func (x *Row) GetValues() []any
- func (x *Row) Set(columnName string, value any) (any, error)
- func (x *Row) SetColumnNames(columnNames []string) error
- func (x *Row) SetValues(values []any) error
- func (x *Row) SetValuesIgnoreError(values []any) *Row
- func (x *Row) String() string
- func (x *Row) ToRows() *Rows
- func (x *Row) ToRowsE() (*Rows, error)
- type Rows
- func (x *Rows) AddColumnName(columnName string) error
- func (x *Rows) AddColumnNames(columnName []string) error
- func (x *Rows) AppendRow(row *Row) error
- func (x *Rows) AppendRowValues(row []any) error
- func (x *Rows) ColumnCount() int
- func (x *Rows) GetCellIntValueOrDefault(rowIndex, columnIndex int, defaultValue int) int
- func (x *Rows) GetCellStringValueOrDefault(rowIndex, columnIndex int, defaultValue string) string
- func (x *Rows) GetCellValue(rowIndex, columnIndex int) (any, error)
- func (x *Rows) GetCellValueOrDefault(rowIndex, columnIndex int, defaultValue any) any
- func (x *Rows) GetColumnNames() []string
- func (x *Rows) GetColumnValue(rowIndex int, columnName string) (any, error)
- func (x *Rows) GetFirstRowColumnValue(columnName string) (any, error)
- func (x *Rows) GetFirstRowColumnValueAsBoolOrDefault(columnName string, defaultValue bool) bool
- func (x *Rows) GetFirstRowColumnValueAsIntOrDefault(columnName string, defaultValue int) int
- func (x *Rows) GetFirstRowColumnValueAsStringOrDefault(columnName string, defaultValue string) string
- func (x *Rows) GetMatrix() [][]any
- func (x *Rows) GetRow(rowIndex int) (*Row, error)
- func (x *Rows) GetRowValues(rowIndex int) ([]any, error)
- func (x *Rows) IsEmpty() bool
- func (x *Rows) RowCount() int
- func (x *Rows) SetColumnNames(columnNames []string) *Rows
- func (x *Rows) SetMatrix(matrix [][]any) error
- func (x *Rows) SplitRowByRow() []*Row
- func (x *Rows) String() string
- func (x *Rows) ToRow() (*Row, error)
- func (x *Rows) Write(cellValue any)
- func (x *Rows) WriteNewLine() error
- type Table
- type TableForeignKey
- type TableIndex
- type TableOptions
- type TableRuntime
- func (x *TableRuntime) ContainsColumnName(columnName string) bool
- func (x *TableRuntime) FindUniqGroup(columnName string) []string
- func (x *TableRuntime) Init(ctx context.Context, clientMeta *ClientMeta, parentTable *Table, ...) *Diagnostics
- func (x *TableRuntime) IsIndexed(columnName string) bool
- func (x *TableRuntime) IsNotNull(columnName string) bool
- func (x *TableRuntime) IsPrimaryKey(columnName string) bool
- func (x *TableRuntime) IsUniq(columnName string) bool
- func (x *TableRuntime) Validate(ctx context.Context, clientMeta *ClientMeta, parentTable *Table, table *Table) *Diagnostics
- type TransformerMeta
Constants ¶
This section is empty.
Variables ¶
var ( ErrorColumnNotEnough = errors.New("column not enough!") ErrorRowNotEnough = errors.New("row not enough!") ErrorColumnAlreadyExists = errors.New("Column already exists") ErrorColumnNotExists = errors.New("column not exists") )
var DefaultWorkerNum uint64 = 100
DefaultWorkerNum The default number of threads when the number of worker threads is not specified
Functions ¶
func GetMemoryUsage ¶ added in v0.0.23
func GetMemoryUsage() int
func NewClientMetaRuntime ¶
func NewClientMetaRuntime(ctx context.Context, workspace, providerName, providerVersion string, myClientMeta *ClientMeta, providerConfigViper *viper.Viper, isRunUserMetaInit bool) (runtime *ClientMetaRuntime, diagnostics *Diagnostics)
func NewDataSourcePullExecutor ¶
func NewDataSourcePullExecutor(workerNum uint64, clientMeta *ClientMeta, errorsHandlerMeta *ErrorsHandlerMeta) (*DataSourceExecutor, *Diagnostics)
NewDataSourcePullExecutor Create a data source data pull actuator @params: workerNum Number of working coroutines @wg: Concurrency control
Types ¶
type ClientLogger ¶
type ClientLogger interface { Debug(msg string, fields ...zap.Field) DebugF(msg string, args ...any) Info(msg string, fields ...zap.Field) InfoF(msg string, args ...any) Warn(msg string, fields ...zap.Field) WarnF(msg string, args ...any) Error(msg string, fields ...zap.Field) ErrorF(msg string, args ...any) Fatal(msg string, fields ...zap.Field) FatalF(msg string, args ...any) LogDiagnostics(prefix string, d *Diagnostics) }
ClientLogger This Component is used to print logs on the client to facilitate troubleshooting when problems occur
type ClientMeta ¶
type ClientMeta struct { ClientLogger // If your application calls the API using a client, you can initialize it here, and when you call the API, // you pass the client you initialized here, so you don't have to re-initialize the client every time you call the API InitClient func(ctx context.Context, clientMeta *ClientMeta, config *viper.Viper) ([]any, *Diagnostics) // You can use a custom Logger, otherwise a default Logger will be initialized InitLogger func(ctx context.Context, clientMeta *ClientMeta, config *viper.Viper) (ClientLogger, *Diagnostics) // contains filtered or unexported fields }
func (*ClientMeta) ClearItem ¶ added in v0.0.2
func (x *ClientMeta) ClearItem()
func (*ClientMeta) GetClientSlice ¶
func (x *ClientMeta) GetClientSlice() []any
func (*ClientMeta) GetIntItem ¶
func (x *ClientMeta) GetIntItem(itemName string, defaultValue int) int
func (*ClientMeta) GetItem ¶
func (x *ClientMeta) GetItem(itemName string) any
func (*ClientMeta) GetStringItem ¶
func (x *ClientMeta) GetStringItem(itemName, defaultValue string) string
func (*ClientMeta) Runtime ¶
func (x *ClientMeta) Runtime() *ClientMetaRuntime
func (*ClientMeta) SetItem ¶
func (x *ClientMeta) SetItem(itemName string, itemValue any)
type ClientMetaRuntime ¶
type ClientMetaRuntime struct { ProviderName string ProviderVersion string Workspace string // contains filtered or unexported fields }
func (*ClientMetaRuntime) ClearItem ¶ added in v0.0.2
func (x *ClientMetaRuntime) ClearItem()
func (*ClientMetaRuntime) GetIntItem ¶
func (x *ClientMetaRuntime) GetIntItem(itemName string, defaultValue int) int
func (*ClientMetaRuntime) GetItem ¶
func (x *ClientMetaRuntime) GetItem(itemName string) any
func (*ClientMetaRuntime) GetStringItem ¶
func (x *ClientMetaRuntime) GetStringItem(itemName, defaultValue string) string
func (*ClientMetaRuntime) SetItem ¶
func (x *ClientMetaRuntime) SetItem(itemName string, itemValue any)
type ClientTaskContext ¶ added in v0.0.2
type ClientTaskContext struct { // client use execution task Client any // client's task Task *DataSourcePullTask }
type Column ¶
type Column struct { // Column's name ColumnName string // Column's type, see schema.ColumnType, Columns must specify a type Type ColumnType // Column comments will be added to the table when the table is created Description string // To indicate how to extract the value of this column from the response content of the API Extractor ColumnValueExtractor // Some options for creating columns, such as uniq, not null Options ColumnOptions // contains filtered or unexported fields }
Column one column definition in table
func (*Column) Runtime ¶
func (x *Column) Runtime() *ColumnRuntime
type ColumnOptions ¶
type ColumnOptions struct { // Whether the value of this column is unique Unique *bool // Whether this column is a not-null entry NotNull *bool }
ColumnOptions You can customize the options you configure when creating columns
func (*ColumnOptions) IsNotNull ¶
func (x *ColumnOptions) IsNotNull() bool
func (*ColumnOptions) IsUniq ¶
func (x *ColumnOptions) IsUniq() bool
type ColumnRuntime ¶
type ColumnRuntime struct {
// contains filtered or unexported fields
}
ColumnRuntime column's runtime
type ColumnType ¶
type ColumnType int
ColumnType The type used to represent the value of the column, which is converted by the specific storage medium at the time of storage
const ( // ColumnTypeNotAssign The default value is not set. If the value is not set, an error will be detected during initialization ColumnTypeNotAssign ColumnType = iota ColumnTypeSmallInt ColumnTypeInt ColumnTypeIntArray ColumnTypeBigInt ColumnTypeFloat ColumnTypeBool ColumnTypeString ColumnTypeStringArray ColumnTypeByteArray ColumnTypeTimestamp ColumnTypeJSON ColumnTypeIp ColumnTypeIpArray ColumnTypeCIDR ColumnTypeCIDRArray ColumnTypeMacAddr ColumnTypeMacAddrArray )
func (*ColumnType) String ¶
func (x *ColumnType) String() string
type ColumnValueConvertor ¶
type ColumnValueConvertor interface { // Convert The method actually responsible for the type conversion // // table: The table corresponding to the value to be converted // column: The column corresponding to the value to be converted // columnValue: The value to convert // // return: // any: The value of the transformed column // *schema.Diagnostics: Any message you want the user to see. These are usually error reports or warnings Convert(table *Table, column *Column, columnValue any) (any, *Diagnostics) }
ColumnValueConvertor This ColumnValueConvertor is used to convert the extracted column value to the corresponding storage medium value
type ColumnValueExtractor ¶
type ColumnValueExtractor interface { // Name The name of this ColumnValueExtractor Name() string // Extract The method actually responsible for extracting the value // ctx: // clientMeta: // task: // row: // column: // result: // return any // return *Diagnostics Extract(ctx context.Context, clientMeta *ClientMeta, client any, task *DataSourcePullTask, row *Row, column *Column, result any) (any, *Diagnostics) // DependencyColumnNames If the values of this class depend on other columns, // the data in the same row will also be parsed according to the DAG dependency topology between the columns DependencyColumnNames(ctx context.Context, clientMeta *ClientMeta, parentTable *Table, table *Table, column *Column) []string // Validate This method is called to check when the runtime is initialized to detect errors as early as possible Validate(ctx context.Context, clientMeta *ClientMeta, parentTable *Table, table *Table, column *Column) *Diagnostics }
ColumnValueExtractor To indicate how to extract the value of this column from the result returned by the API's interface See package transformer.value_extractor for the default implementation
type ConsumerSemaphore ¶ added in v0.0.10
type ConsumerSemaphore struct {
// contains filtered or unexported fields
}
ConsumerSemaphore Used to coordinate the work and exit of all consumers
func NewConsumerSemaphore ¶ added in v0.0.10
func NewConsumerSemaphore(clientMeta *ClientMeta) *ConsumerSemaphore
func (*ConsumerSemaphore) Idle ¶ added in v0.0.10
func (x *ConsumerSemaphore) Idle(consumerId uint64)
func (*ConsumerSemaphore) Init ¶ added in v0.0.10
func (x *ConsumerSemaphore) Init(consumerId uint64)
func (*ConsumerSemaphore) IsAllConsumerDone ¶ added in v0.0.10
func (x *ConsumerSemaphore) IsAllConsumerDone() bool
func (*ConsumerSemaphore) Running ¶ added in v0.0.10
func (x *ConsumerSemaphore) Running(consumerId uint64)
type DataSource ¶
type DataSource struct { // The pull method is responsible for pulling the data, The pulled data is returned to the resultChannel, one result at a time Pull func(ctx context.Context, clientMeta *ClientMeta, client any, task *DataSourcePullTask, resultChannel chan<- any) *Diagnostics }
DataSource Data sources can produce data
func DataSourceParentRawFieldSliceValue ¶
func DataSourceParentRawFieldSliceValue(structSelector string) DataSource
DataSourceParentRawFieldSliceValue Gets a slice value from the original return result of the parent table
func DataSourceParentRawFieldValue ¶
func DataSourceParentRawFieldValue(structSelector string) DataSource
DataSourceParentRawFieldValue Gets a value from the original return result of the parent table
type DataSourceExecutor ¶
type DataSourceExecutor struct {
// contains filtered or unexported fields
}
DataSourceExecutor Pulls the actuator of the data source
func (*DataSourceExecutor) ShutdownAndAwaitTermination ¶
func (x *DataSourceExecutor) ShutdownAndAwaitTermination(ctx context.Context) *Diagnostics
ShutdownAndAwaitTermination Close the task queue and hold the current coroutine until the task completes or times out
func (*DataSourceExecutor) Submit ¶
func (x *DataSourceExecutor) Submit(ctx context.Context, task *DataSourcePullTask) *Diagnostics
Submit Submit a data source pull task for execution
type DataSourcePullTask ¶
type DataSourcePullTask struct { // global uniq task id TaskId string Ctx context.Context ParentTask *DataSourcePullTask ParentTable *Table ParentRow *Row ParentRawResult any // Only if the task is successfully executed will the raw result be backfilled here // This is so that when a task result is expand, there is a way to access the before expand results if you need to NotExpandRawResult any Table *Table // What happens to the pulled data ResultHandler func(ctx context.Context, clientMeta *ClientMeta, client any, task *DataSourcePullTask, result any) (*Rows, []any, *Diagnostics) // Callback method when the task is completed TaskDoneCallback func(ctx context.Context, clientMeta *ClientMeta, task *DataSourcePullTask) *Diagnostics // You can pass some messages back at execution time DiagnosticsChannel chan *Diagnostics // Whether this task is a Root task IsRootTask bool // The client context required to perform the task Client any // Is the expansion completed? IsExpandDone bool // contains filtered or unexported fields }
DataSourcePullTask Represents a data source pull task
func (*DataSourcePullTask) ClearItem ¶ added in v0.0.2
func (x *DataSourcePullTask) ClearItem()
func (*DataSourcePullTask) Clone ¶ added in v0.0.2
func (x *DataSourcePullTask) Clone() *DataSourcePullTask
func (*DataSourcePullTask) GetIntItem ¶ added in v0.0.2
func (x *DataSourcePullTask) GetIntItem(itemName string, defaultValue int) int
func (*DataSourcePullTask) GetItem ¶ added in v0.0.2
func (x *DataSourcePullTask) GetItem(itemName string) any
func (*DataSourcePullTask) GetStringItem ¶ added in v0.0.2
func (x *DataSourcePullTask) GetStringItem(itemName, defaultValue string) string
func (*DataSourcePullTask) LookupIntItem ¶ added in v0.0.2
func (x *DataSourcePullTask) LookupIntItem(itemName string, defaultValue int) int
func (*DataSourcePullTask) LookupItem ¶ added in v0.0.2
func (x *DataSourcePullTask) LookupItem(itemName string) any
func (*DataSourcePullTask) LookupStringItem ¶ added in v0.0.2
func (x *DataSourcePullTask) LookupStringItem(itemName, defaultValue string) string
func (*DataSourcePullTask) SetItem ¶ added in v0.0.2
func (x *DataSourcePullTask) SetItem(itemName string, itemValue any)
type DataSourcePullTaskQueue ¶ added in v0.0.10
type DataSourcePullTaskQueue struct {
// contains filtered or unexported fields
}
DataSourcePullTaskQueue A dedicated task queue allows you to expand the task queue at will
func NewDataSourcePullTaskQueue ¶ added in v0.0.10
func NewDataSourcePullTaskQueue() *DataSourcePullTaskQueue
func (*DataSourcePullTaskQueue) Add ¶ added in v0.0.10
func (x *DataSourcePullTaskQueue) Add(task *DataSourcePullTask)
func (*DataSourcePullTaskQueue) IsEmpty ¶ added in v0.0.10
func (x *DataSourcePullTaskQueue) IsEmpty() bool
func (*DataSourcePullTaskQueue) Take ¶ added in v0.0.10
func (x *DataSourcePullTaskQueue) Take() *DataSourcePullTask
type DefaultClientLogger ¶
type DefaultClientLogger struct { DesensitizationFunction DesensitizationFunction // contains filtered or unexported fields }
func NewDefaultClientLogger ¶
func NewDefaultClientLogger(loggerConfig *DefaultClientLoggerConfig) (*DefaultClientLogger, error)
func (*DefaultClientLogger) Debug ¶
func (x *DefaultClientLogger) Debug(msg string, fields ...zap.Field)
func (*DefaultClientLogger) DebugF ¶
func (x *DefaultClientLogger) DebugF(msg string, args ...any)
func (*DefaultClientLogger) Error ¶
func (x *DefaultClientLogger) Error(msg string, fields ...zap.Field)
func (*DefaultClientLogger) ErrorF ¶
func (x *DefaultClientLogger) ErrorF(msg string, args ...any)
func (*DefaultClientLogger) Fatal ¶
func (x *DefaultClientLogger) Fatal(msg string, fields ...zap.Field)
func (*DefaultClientLogger) FatalF ¶
func (x *DefaultClientLogger) FatalF(msg string, args ...any)
func (*DefaultClientLogger) Info ¶
func (x *DefaultClientLogger) Info(msg string, fields ...zap.Field)
func (*DefaultClientLogger) InfoF ¶
func (x *DefaultClientLogger) InfoF(msg string, args ...any)
func (*DefaultClientLogger) LogDiagnostics ¶ added in v0.0.21
func (x *DefaultClientLogger) LogDiagnostics(prefix string, d *Diagnostics)
LogDiagnostics Logs need to be able to print diagnostic logs directly
func (*DefaultClientLogger) Name ¶
func (x *DefaultClientLogger) Name() string
func (*DefaultClientLogger) Warn ¶
func (x *DefaultClientLogger) Warn(msg string, fields ...zap.Field)
func (*DefaultClientLogger) WarnF ¶
func (x *DefaultClientLogger) WarnF(msg string, args ...any)
type DefaultClientLoggerConfig ¶
type DefaultClientLoggerConfig struct { DesensitizationFunction func(ctx context.Context, msg string, args ...any) (string, []any) FileLogEnabled bool ConsoleLogEnabled bool EncodeLogsAsJson bool Level string LevelIdentUppercase bool MaxDayAge int ShowLine bool ConsoleNoColor bool MaxMegaBytesSize int MaxBackups int TimeFormat string Prefix string // contains filtered or unexported fields }
func NewDefaultClientLoggerConfig ¶
func NewDefaultClientLoggerConfig(workspace, providerName string) *DefaultClientLoggerConfig
func (*DefaultClientLoggerConfig) EncodeLevel ¶
func (x *DefaultClientLoggerConfig) EncodeLevel() zapcore.LevelEncoder
func (*DefaultClientLoggerConfig) GetEncoder ¶
func (x *DefaultClientLoggerConfig) GetEncoder() zapcore.Encoder
func (*DefaultClientLoggerConfig) GetEncoderConfig ¶
func (x *DefaultClientLoggerConfig) GetEncoderConfig() zapcore.EncoderConfig
func (*DefaultClientLoggerConfig) GetEncoderCore ¶
func (x *DefaultClientLoggerConfig) GetEncoderCore() []zapcore.Core
func (*DefaultClientLoggerConfig) GetLevelPriority ¶
func (x *DefaultClientLoggerConfig) GetLevelPriority(level zapcore.Level) zap.LevelEnablerFunc
func (*DefaultClientLoggerConfig) GetLogWriter ¶
func (x *DefaultClientLoggerConfig) GetLogWriter(level string) zapcore.WriteSyncer
func (*DefaultClientLoggerConfig) TranslationLevel ¶
func (x *DefaultClientLoggerConfig) TranslationLevel() zapcore.Level
type Diagnostic ¶
type Diagnostic struct {
// contains filtered or unexported fields
}
func NewDiagnostic ¶
func NewDiagnostic(level DiagnosticLevel, content string) *Diagnostic
func NewErrorDiagnostic ¶
func NewErrorDiagnostic(content string) *Diagnostic
func NewFatalDiagnostic ¶
func NewFatalDiagnostic(content string) *Diagnostic
func NewInfoDiagnostic ¶
func NewInfoDiagnostic(content string) *Diagnostic
func NewWarnDiagnostic ¶
func NewWarnDiagnostic(content string) *Diagnostic
func (*Diagnostic) Content ¶
func (x *Diagnostic) Content() string
func (*Diagnostic) Level ¶
func (x *Diagnostic) Level() DiagnosticLevel
type DiagnosticLevel ¶
type DiagnosticLevel int
const ( DiagnosisLevelTrace DiagnosticLevel = iota DiagnosisLevelDebug DiagnosisLevelInfo DiagnosisLevelWarn DiagnosisLevelError DiagnosisLevelFatal )
func (DiagnosticLevel) String ¶
func (x DiagnosticLevel) String() string
type Diagnostics ¶
type Diagnostics struct {
// contains filtered or unexported fields
}
Diagnostics Represents a series of diagnostic information
func NewDiagnostics ¶
func NewDiagnostics() *Diagnostics
func NewDiagnosticsAddErrorMsg ¶
func NewDiagnosticsAddErrorMsg(format string, args ...any) *Diagnostics
func NewDiagnosticsErrorColumnValueExtractor ¶
func NewDiagnosticsErrorColumnValueExtractor(table *Table, column *Column, err error) *Diagnostics
func NewDiagnosticsErrorMsgColumnValueExtractor ¶
func NewDiagnosticsErrorMsgColumnValueExtractor(table *Table, column *Column, format string, args ...any) *Diagnostics
func NewDiagnosticsErrorMsgPullTable ¶
func NewDiagnosticsErrorMsgPullTable(table *Table, format string, args ...any) *Diagnostics
func NewDiagnosticsErrorPullTable ¶
func NewDiagnosticsErrorPullTable(table *Table, err error) *Diagnostics
func (*Diagnostics) Add ¶
func (x *Diagnostics) Add(d any) *Diagnostics
Add d type *Diagnostic or *Diagnostics or error
func (*Diagnostics) AddDiagnostic ¶
func (x *Diagnostics) AddDiagnostic(diagnostic *Diagnostic) *Diagnostics
func (*Diagnostics) AddDiagnostics ¶
func (x *Diagnostics) AddDiagnostics(diagnostics *Diagnostics) *Diagnostics
func (*Diagnostics) AddError ¶
func (x *Diagnostics) AddError(err error) *Diagnostics
func (*Diagnostics) AddErrorColumnValueExtractor ¶
func (x *Diagnostics) AddErrorColumnValueExtractor(table *Table, column *Column, err error) *Diagnostics
AddErrorColumnValueExtractor There was an error in extract column value
func (*Diagnostics) AddErrorMsg ¶
func (x *Diagnostics) AddErrorMsg(format string, args ...any) *Diagnostics
func (*Diagnostics) AddErrorMsgColumnValueExtractor ¶
func (x *Diagnostics) AddErrorMsgColumnValueExtractor(table *Table, column *Column, format string, args ...any) *Diagnostics
func (*Diagnostics) AddErrorMsgPullTable ¶
func (x *Diagnostics) AddErrorMsgPullTable(table *Table, format string, args ...any) *Diagnostics
func (*Diagnostics) AddErrorPullTable ¶
func (x *Diagnostics) AddErrorPullTable(table *Table, err error) *Diagnostics
AddErrorPullTable There was an error in pull table
func (*Diagnostics) AddFatal ¶
func (x *Diagnostics) AddFatal(format string, args ...any) *Diagnostics
func (*Diagnostics) AddInfo ¶
func (x *Diagnostics) AddInfo(format string, args ...any) *Diagnostics
func (*Diagnostics) AddWarn ¶
func (x *Diagnostics) AddWarn(format string, args ...any) *Diagnostics
func (*Diagnostics) GetDiagnosticSlice ¶
func (x *Diagnostics) GetDiagnosticSlice() []*Diagnostic
func (*Diagnostics) HasError ¶
func (x *Diagnostics) HasError() bool
func (*Diagnostics) IsEmpty ¶
func (x *Diagnostics) IsEmpty() bool
func (*Diagnostics) Size ¶
func (x *Diagnostics) Size() int
func (*Diagnostics) String ¶ added in v0.0.17
func (x *Diagnostics) String() string
func (*Diagnostics) ToString ¶
func (x *Diagnostics) ToString() string
type ErrorsHandlerMeta ¶ added in v0.0.2
type ErrorsHandlerMeta struct { // You can configure which types of errors are blocked from users IgnoredErrors []IgnoredError // contains filtered or unexported fields }
func (*ErrorsHandlerMeta) IsIgnore ¶ added in v0.0.2
func (x *ErrorsHandlerMeta) IsIgnore(err IgnoredError) bool
type ErrorsHandlerMetaRuntime ¶ added in v0.0.2
type ErrorsHandlerMetaRuntime struct {
// contains filtered or unexported fields
}
func NewErrorsHandlerMetaRuntime ¶ added in v0.0.2
func NewErrorsHandlerMetaRuntime(myErrorsHandlerMeta *ErrorsHandlerMeta) *ErrorsHandlerMetaRuntime
func (*ErrorsHandlerMetaRuntime) IsNeedIgnore ¶ added in v0.0.2
func (x *ErrorsHandlerMetaRuntime) IsNeedIgnore(err IgnoredError) bool
type IgnoredError ¶ added in v0.0.2
type IgnoredError int
const ( // IgnoredErrorAll Ignore the following types of errors IgnoredErrorAll IgnoredError = iota // IgnoredErrorOnPullTable When an error occurs while pulling the table, the error is ignored and the user is not reported, but the log is printed silently IgnoredErrorOnPullTable // IgnoredErrorOnTransformerRow Ignore errors when converting row IgnoredErrorOnTransformerRow // IgnoredErrorOnTransformerCell Ignore errors when converting cell IgnoredErrorOnTransformerCell // IgnoredErrorOnSaveResult If an error is reported when the retrieved data is saved to the table, the system ignores // the error and does not print it to the user. Instead, it silently records a log IgnoredErrorOnSaveResult )
type Row ¶
type Row struct {
// contains filtered or unexported fields
}
Row Represents a row in a matrix or database
func (*Row) AddColumnName ¶
AddColumnName Add a column
func (*Row) AddColumnNames ¶
AddColumnNames Add multiple columns at a time
func (*Row) GetColumnNames ¶
GetColumnNames Gets all current column's name return as string slice
func (*Row) GetIntOrDefault ¶
func (*Row) GetOrDefault ¶ added in v0.0.4
func (*Row) GetStringOrDefault ¶
GetStringOrDefault The fetch column value is returned as String, or the default value in case of an error
func (*Row) SetColumnNames ¶
SetColumnNames Setting the current column is equivalent to resetting, which is an override setting
func (*Row) SetValuesIgnoreError ¶
SetValuesIgnoreError Set values for all columns of the row at once, ignoring errors
type Rows ¶
type Rows struct {
// contains filtered or unexported fields
}
Rows Represents a number of rows of data in a table, a collection of rows
func (*Rows) AddColumnName ¶
AddColumnName Add a column to the table
func (*Rows) AddColumnNames ¶
AddColumnNames Add multiple columns at a time
func (*Rows) AppendRowValues ¶
AppendRowValues Write a line
func (*Rows) GetCellIntValueOrDefault ¶
func (*Rows) GetCellStringValueOrDefault ¶
func (*Rows) GetCellValueOrDefault ¶
func (*Rows) GetColumnNames ¶
GetColumnNames Gets all column names
func (*Rows) GetColumnValue ¶
GetColumnValue Get the value of a given column for a given row. Note that this method is inefficient and should be avoided if possible
func (*Rows) GetFirstRowColumnValue ¶
func (*Rows) GetFirstRowColumnValueAsBoolOrDefault ¶
func (*Rows) GetFirstRowColumnValueAsIntOrDefault ¶
func (*Rows) GetFirstRowColumnValueAsStringOrDefault ¶
func (*Rows) GetRowValues ¶
GetRowValues Gets the values of all columns of the specified row
func (*Rows) SetColumnNames ¶
SetColumnNames Set the column name. The matrix value is reset when the column name is set
func (*Rows) SplitRowByRow ¶
SplitRowByRow Partition the matrix into matrices with only one row
type Table ¶
type Table struct { // Table's name TableName string // You can provide some description information, which will be included in the automatic document generation Description string // What are the columns in this table Columns []*Column // A table can have child tables whose data depends on the current table SubTables []*Table // Some configuration items of this table Options *TableOptions // The data source used to provide data for this table DataSource DataSource // If your table needs to extend the default call method, you can implement this function // The default is to use Task once per client // But you can call the client multiple times by making multiple copies of the client // When a value is returned, it is called once with each of the returned clients // The second parameter, task, if it is not returned, uses the original task. If it is returned, it must be the same length as the client and correspond one to one ExpandClientTask func(ctx context.Context, clientMeta *ClientMeta, client any, task *DataSourcePullTask) []*ClientTaskContext // An increasing number. If the table structure has changed, the version number needs to be changed Version uint64 // contains filtered or unexported fields }
Table A Provider may have many tables, which are the API's persistent representation
func (*Table) GetFullTableName ¶
func (*Table) GetNamespace ¶
func (*Table) GetPrimaryKeys ¶
func (*Table) Runtime ¶
func (x *Table) Runtime() *TableRuntime
type TableForeignKey ¶
type TableForeignKey struct { // Leaving it unset automatically generates a name Name string // The column name of the current table SelfColumns []string // The table to associate with ForeignTableName string // The column of the table to be associated with ForeignColumns []string Description string }
TableForeignKey Foreign key table
func (*TableForeignKey) GetName ¶
func (x *TableForeignKey) GetName(tableName string) string
type TableIndex ¶
type TableIndex struct { // index's name Name string // Index the columns involved ColumnNames []string // Whether this index is unique IsUniq *bool // Please briefly explain what this index does Description string }
TableIndex You can create indexes, composite indexes, and the like to speed up queries
func (*TableIndex) GetName ¶
func (x *TableIndex) GetName(tableName string) string
type TableOptions ¶
type TableOptions struct { // Primary key: Which columns are the primary keys of the table. // Note that this is in order. The primary keys are created in the given order PrimaryKeys []string // Foreign key: This table can be associated to other tables through foreign keys ForeignKeys []*TableForeignKey // Indexes: There are some indexes that can be defined in a table. Generally, // compound indexes are defined in this place. If an index involves only one column, then it is OK to define on the column Indexes []*TableIndex }
TableOptions When you create a table, you can specify primary keys, foreign keys, indexes, and so on
func (*TableOptions) GenPrimaryKeysName ¶
func (x *TableOptions) GenPrimaryKeysName(tableName string) string
GenPrimaryKeysName Automatically generate the name of the primary key
type TableRuntime ¶
type TableRuntime struct { // like database name Namespace string // The order in which columns are resolved, Because there may be a dependency order between columns, // the resolution order is obtained by topological sorting of the DAG ColumnExtractorSorted []*Column // contains filtered or unexported fields }
TableRuntime The runtime of the table, the relevant context during the runtime and so forth will be taken care of by this struct
func (*TableRuntime) ContainsColumnName ¶
func (x *TableRuntime) ContainsColumnName(columnName string) bool
ContainsColumnName Whether the table contains the given column
func (*TableRuntime) FindUniqGroup ¶ added in v0.0.20
func (x *TableRuntime) FindUniqGroup(columnName string) []string
FindUniqGroup The current column may not be unique by itself, but it is unique when combined with other columns. Get the unique group
func (*TableRuntime) Init ¶
func (x *TableRuntime) Init(ctx context.Context, clientMeta *ClientMeta, parentTable *Table, myTable *Table) *Diagnostics
Init Initializes the runtime of the table
func (*TableRuntime) IsIndexed ¶ added in v0.0.20
func (x *TableRuntime) IsIndexed(columnName string) bool
IsIndexed Whether this column is the column to be indexed
func (*TableRuntime) IsNotNull ¶ added in v0.0.20
func (x *TableRuntime) IsNotNull(columnName string) bool
IsNotNull Whether the value of this column is non-null
func (*TableRuntime) IsPrimaryKey ¶ added in v0.0.20
func (x *TableRuntime) IsPrimaryKey(columnName string) bool
IsPrimaryKey Whether this column is a primary key column It's a primary key itself, or there are multiple primary keys, and it's one of them
func (*TableRuntime) IsUniq ¶ added in v0.0.20
func (x *TableRuntime) IsUniq(columnName string) bool
IsUniq Whether the value of this column is unique
func (*TableRuntime) Validate ¶
func (x *TableRuntime) Validate(ctx context.Context, clientMeta *ClientMeta, parentTable *Table, table *Table) *Diagnostics
Validate The table is self-checked
type TransformerMeta ¶
type TransformerMeta struct { // if you api will return some valid string, you can config on this field // // For example, if the value of an int field is not available, the API will return a uniform invalid value, such as N/A. // Even though it is an int field, the API will return a string it's value is "N/A", so you can use this configuration // to be compatible with this situation. The underlying converter will check and ignore any invalid value configured. // // Note that the checker will only check for fields that are not String. If an invalid value is specified on a String // field, it will be stored because the checker cannot determine whether it is a valid value or an invalid value, so // it plays it safe DefaultColumnValueConvertorBlackList []string // If you do not want to use the default type converter, you can use your own custom type converter. // In order to realize your own ColumnValueConvertor, implementation schema.ColumnValueConvertor interface // // If you do not configure this field, a default type converter will be initialized, default // ColumnValueConvertor is column_value_convertor.DefaultColumnValueConvertor ColumnValueConvertor ColumnValueConvertor // If the Pull method of the DataSource returns Array or Slice, the DataSource is automatically expanded to multiple results DataSourcePullResultAutoExpand bool }
TransformerMeta data transformation meta information
func (*TransformerMeta) IsUseDefaultColumnValueConvertor ¶
func (x *TransformerMeta) IsUseDefaultColumnValueConvertor() bool
Source Files ¶
- client_logger.go
- client_meta.go
- client_meta_runtime.go
- client_task_context.go
- column.go
- column_options.go
- column_runtime.go
- column_validator.go
- column_value_convertor.go
- column_value_extractor.go
- column_value_type.go
- data_source.go
- data_source_executor.go
- data_source_pull_task.go
- diagnostic.go
- errors_handler_meta.go
- errors_handler_meta_runtime.go
- row.go
- rows.go
- table.go
- table_options.go
- table_runtime.go
- table_validator.go
- transformer_meta.go