Documentation
¶
Index ¶
- Variables
- func HashAPIKey(raw string) string
- func HashPassword(password string) (string, error)
- func NewAPIKeySecret() (raw, prefix, hash string, err error)
- func NewID(prefix string) string
- func ParseWarehouseTarget(raw string) (schema, table string, err error)
- func ValidSemanticType(value string) bool
- func ValidateWebhookURL(provider, raw string) error
- func VerifyPassword(encoded, password string) bool
- type AIProvider
- type APIKey
- type APIKeyStore
- type AdminSettings
- type Alert
- type AlertStore
- type AuthSettings
- type Bookmark
- type BookmarkStore
- type CatalogService
- func (s CatalogService) Add(ctx context.Context, input ConnectionRequest) (Database, error)
- func (s CatalogService) ConnectionSettings(id string) (ConnectionRequest, error)
- func (s CatalogService) EnsureConnected(ctx context.Context, databaseID string) error
- func (s CatalogService) LiveStatus(item Database) Database
- func (s CatalogService) Remove(id string) error
- func (s CatalogService) RescanTable(ctx context.Context, databaseID, schema, table string) (SchemaSnapshot, error)
- func (s CatalogService) Snapshot(databaseID string) (SchemaSnapshot, error)
- func (s CatalogService) Sync(ctx context.Context, databaseID string) (SchemaSnapshot, error)
- func (s CatalogService) Test(ctx context.Context, input ConnectionRequest) error
- func (s CatalogService) Update(ctx context.Context, id string, input ConnectionRequest) (Database, error)
- type ChartAxisSpec
- type ChartColorSegment
- type ChartColumnStyle
- type ChartSeriesStyle
- type ChartSpec
- type ChatRequest
- type ChatResponse
- type ClickBehavior
- type Collection
- type CollectionShare
- type CollectionStore
- type Column
- type ConnectionRequest
- type ConnectionSecretStore
- type Dashboard
- type DashboardCard
- type DashboardFilter
- type DashboardPublicAccess
- type DashboardPublicLinkUpdate
- type DashboardStore
- type DashboardTab
- type Database
- type DatabaseConnector
- type DatabaseStore
- type DeveloperSettings
- type ExternalIdentityLink
- type FieldMeta
- type FieldRef
- type FieldStore
- type FilterMapping
- type FilterValue
- type GlossaryStore
- type GlossaryTerm
- type Group
- type GroupStore
- type IdentityProvider
- type Layout
- type LineageEdge
- type LineageStore
- type MaterializeResult
- type MaterializeSpec
- type MaterializedTable
- type MaterializedTableStore
- type MetadataStore
- type Metric
- type MetricStore
- type Model
- type ModelColumn
- type ModelStore
- type Notification
- type NotificationStore
- type OrgDirectory
- type OrgUnit
- type PermissionGraph
- type ProjectAccessRule
- type QueryExecutor
- type QueryResult
- type QueryService
- type Question
- type QuestionStore
- type Revision
- type RevisionStore
- type Run
- type RunStore
- type SSHTunnelRequest
- type Schedule
- type ScheduleProposal
- type ScheduleStore
- type ScheduleSummary
- type SchemaSnapshot
- type SchemaSnapshotStore
- type SearchHit
- type SearchStore
- type Segment
- type SegmentStore
- type SemanticTypeOption
- type Session
- type SessionStore
- type SettingStore
- type SetupRequest
- type Subscription
- type SubscriptionStore
- type Table
- type TableAnnotation
- type TrashItem
- type UploadedTable
- type UploadedTablePreview
- type User
- type UserStore
- type WarehouseWriter
- type WebhookEndpoint
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("not found")
var ErrWarehouseCommitUnknown = errors.New("目标库提交结果未确认")
var ErrWarehouseTargetInUse = errors.New("已有沉淀计划或数据表使用此目标,请更换保存表名")
var SemanticTypeOptions = []SemanticTypeOption{ {Value: "EntityKey", Label: "主键(实体标识)"}, {Value: "ForeignKey", Label: "外键"}, {Value: "Quantity", Label: "数量"}, {Value: "Score", Label: "评分"}, {Value: "Percentage", Label: "百分比"}, {Value: "Currency", Label: "金额(货币)"}, {Value: "Discount", Label: "折扣"}, {Value: "Income", Label: "收入"}, {Value: "Latitude", Label: "纬度"}, {Value: "Longitude", Label: "经度"}, {Value: "CreationDate", Label: "创建日期"}, {Value: "CreationTime", Label: "创建时间"}, {Value: "CreationTimestamp", Label: "创建日期时间"}, {Value: "JoinedDate", Label: "加入日期"}, {Value: "JoinedTime", Label: "加入时间"}, {Value: "JoinedTimestamp", Label: "加入日期时间"}, {Value: "Birthday", Label: "生日", Sensitive: true}, {Value: "EntityName", Label: "实体名称"}, {Value: "PersonName", Label: "姓名", Sensitive: true}, {Value: "MobilePhone", Label: "手机号", Sensitive: true}, {Value: "NationalID", Label: "身份证号", Sensitive: true}, {Value: "BankCard", Label: "银行卡号", Sensitive: true}, {Value: "Email", Label: "电子邮箱", Sensitive: true}, {Value: "Address", Label: "详细地址", Sensitive: true}, {Value: "URL", Label: "网页地址"}, {Value: "ImageURL", Label: "图片地址"}, {Value: "AvatarURL", Label: "头像地址"}, {Value: "Category", Label: "分类"}, {Value: "Name", Label: "名称"}, {Value: "Title", Label: "标题"}, {Value: "Description", Label: "说明"}, {Value: "Product", Label: "产品"}, {Value: "Source", Label: "来源"}, {Value: "City", Label: "城市"}, {Value: "State", Label: "省/州"}, {Value: "Country", Label: "国家/地区"}, {Value: "ZipCode", Label: "邮政编码"}, {Value: "IPAddress", Label: "IP 地址", Sensitive: true}, {Value: "FieldContainingJSON", Label: "JSON 数据"}, }
var SemanticTypes = []string{
"EntityKey", "ForeignKey",
"Quantity", "Score", "Percentage", "Currency", "Discount", "Income", "Latitude", "Longitude",
"CreationDate", "CreationTime", "CreationTimestamp",
"JoinedDate", "JoinedTime", "JoinedTimestamp", "Birthday",
"EntityName", "PersonName", "MobilePhone", "NationalID", "BankCard", "Email", "Address", "URL", "ImageURL", "AvatarURL", "Category", "Name", "Title",
"Description", "Product", "Source", "City", "State", "Country", "ZipCode",
"IPAddress", "FieldContainingJSON",
}
Functions ¶
func HashAPIKey ¶
func HashPassword ¶
func NewAPIKeySecret ¶
func ParseWarehouseTarget ¶
func ValidSemanticType ¶
func ValidateWebhookURL ¶
ValidateWebhookURL checks the address without echoing credentials or contacting the provider. Generic webhooks may point to an organization's own HTTP server.
func VerifyPassword ¶
Types ¶
type AIProvider ¶
type APIKeyStore ¶
type AdminSettings ¶
type AdminSettings struct {
SiteName string `json:"site_name"`
Timezone string `json:"timezone"`
PublicScheme string `json:"public_scheme"`
CustomDomain string `json:"custom_domain,omitempty"`
PublicPort int `json:"public_port,omitempty"`
PublicSharingEnabled bool `json:"public_sharing_enabled"`
EmbeddingEnabled bool `json:"embedding_enabled"`
}
AdminSettings contains instance-wide switches that must be enforced by the HTTP layer, rather than merely hidden in the UI.
type Alert ¶
type Alert struct {
ID string `json:"id"`
QuestionID string `json:"question_id"`
Name string `json:"name"`
Kind string `json:"kind"` // results | goal | progress
Cron string `json:"cron,omitempty"`
Channel string `json:"channel"`
Goal float64 `json:"goal,omitempty"`
Once bool `json:"once"`
Enabled bool `json:"enabled"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type AlertStore ¶
type AuthSettings ¶
type AuthSettings struct {
PasswordLoginEnabled bool `json:"password_login_enabled"`
EnabledProviderIDs []string `json:"enabled_provider_ids"`
}
AuthSettings governs which sign-in methods are available to end users. Password sign-in is on by default so an administrator cannot be locked out before a third-party provider has been configured.
type BookmarkStore ¶
type CatalogService ¶
type CatalogService struct {
Store DatabaseStore
Connector DatabaseConnector
Secrets ConnectionSecretStore
Snapshots SchemaSnapshotStore
}
func (CatalogService) Add ¶
func (s CatalogService) Add(ctx context.Context, input ConnectionRequest) (Database, error)
func (CatalogService) ConnectionSettings ¶
func (s CatalogService) ConnectionSettings(id string) (ConnectionRequest, error)
func (CatalogService) EnsureConnected ¶
func (s CatalogService) EnsureConnected(ctx context.Context, databaseID string) error
func (CatalogService) LiveStatus ¶
func (s CatalogService) LiveStatus(item Database) Database
func (CatalogService) Remove ¶
func (s CatalogService) Remove(id string) error
func (CatalogService) RescanTable ¶
func (s CatalogService) RescanTable(ctx context.Context, databaseID, schema, table string) (SchemaSnapshot, error)
func (CatalogService) Snapshot ¶
func (s CatalogService) Snapshot(databaseID string) (SchemaSnapshot, error)
func (CatalogService) Sync ¶
func (s CatalogService) Sync(ctx context.Context, databaseID string) (SchemaSnapshot, error)
func (CatalogService) Test ¶
func (s CatalogService) Test(ctx context.Context, input ConnectionRequest) error
Test validates every network hop without writing catalog metadata.
func (CatalogService) Update ¶
func (s CatalogService) Update(ctx context.Context, id string, input ConnectionRequest) (Database, error)
type ChartAxisSpec ¶
type ChartAxisSpec struct {
Title string `json:"title,omitempty"`
Scale string `json:"scale,omitempty"` // linear | log | pow | timeseries | ordinal | histogram
Enabled string `json:"enabled,omitempty"`
Labels *bool `json:"labels,omitempty"`
AutoRange *bool `json:"auto_range,omitempty"`
Min *float64 `json:"min,omitempty"`
Max *float64 `json:"max,omitempty"`
UnpinZero bool `json:"unpin_zero,omitempty"`
Ticks *int `json:"ticks,omitempty"`
}
type ChartColorSegment ¶
type ChartColumnStyle ¶
type ChartSeriesStyle ¶
type ChartSeriesStyle struct {
Color string `json:"color,omitempty"`
Title string `json:"title,omitempty"`
Display string `json:"display,omitempty"` // line | bar | area
Axis string `json:"axis,omitempty"` // left | right | auto
LineStyle string `json:"line_style,omitempty"`
LineSize string `json:"line_size,omitempty"`
Visible *bool `json:"visible,omitempty"`
Markers string `json:"markers,omitempty"` // auto | on | off
Missing string `json:"missing,omitempty"`
Interpolate string `json:"interpolate,omitempty"`
ShowValues *bool `json:"show_values,omitempty"`
ShowTrend *bool `json:"show_trend,omitempty"`
}
type ChartSpec ¶
type ChartSpec struct {
Type string `json:"type"`
X string `json:"x,omitempty"`
Y []string `json:"y,omitempty"`
Breakout string `json:"breakout,omitempty"`
Stacked bool `json:"stacked,omitempty"`
Stacking string `json:"stacking,omitempty"`
ShowLegend *bool `json:"show_legend,omitempty"`
Legend string `json:"legend,omitempty"`
ShowLabels bool `json:"show_labels,omitempty"`
Smooth *bool `json:"smooth,omitempty"`
Interpolation string `json:"interpolation,omitempty"`
Missing string `json:"missing,omitempty"`
XTitle string `json:"x_title,omitempty"`
YTitle string `json:"y_title,omitempty"`
XAxis *ChartAxisSpec `json:"x_axis,omitempty"`
YAxis *ChartAxisSpec `json:"y_axis,omitempty"`
Series map[string]ChartSeriesStyle `json:"series,omitempty"`
Columns map[string]ChartColumnStyle `json:"columns,omitempty"`
Search string `json:"search,omitempty"`
Sort string `json:"sort,omitempty"`
SortDir string `json:"sort_dir,omitempty"`
MaxCategories int `json:"max_categories,omitempty"`
OtherColor string `json:"other_color,omitempty"`
SliceThreshold *float64 `json:"slice_threshold,omitempty"`
ShowGoal *bool `json:"show_goal,omitempty"`
Goal *float64 `json:"goal,omitempty"`
GoalLabel string `json:"goal_label,omitempty"`
Trendline bool `json:"trendline,omitempty"`
AutoSplit *bool `json:"auto_split,omitempty"`
LabelFrequency string `json:"label_frequency,omitempty"`
ValueFormat string `json:"value_format,omitempty"`
StackValues string `json:"stack_values,omitempty"`
Markers string `json:"markers,omitempty"`
ShowTotal *bool `json:"show_total,omitempty"`
Percent string `json:"percent,omitempty"`
Donut *bool `json:"donut,omitempty"`
Prefix string `json:"prefix,omitempty"`
Suffix string `json:"suffix,omitempty"`
Decimals *int `json:"decimals,omitempty"`
NumberStyle string `json:"number_style,omitempty"`
Multiply *float64 `json:"multiply,omitempty"`
Color string `json:"color,omitempty"`
Segments []ChartColorSegment `json:"segments,omitempty"`
}
type ChatRequest ¶
type ChatResponse ¶
type ClickBehavior ¶
type Collection ¶
type Collection struct {
ID string `json:"id"`
ParentID string `json:"parent_id,omitempty"`
Name string `json:"name"`
PersonalOwnerUserID string `json:"personal_owner_user_id,omitempty"`
OwnerGroupID string `json:"owner_group_id,omitempty"`
Kind string `json:"kind"` // personal_project | team_project
CreatedAt time.Time `json:"created_at"`
// These are presentation fields, populated only for a recipient of a
// personal-group share. Shared groups are always view-only.
ReadOnly bool `json:"read_only,omitempty"`
}
type CollectionShare ¶
type CollectionShare struct {
}
type CollectionStore ¶
type CollectionStore interface {
Create(Collection) error
Update(Collection) error
List() ([]Collection, error)
ByID(id string) (Collection, error)
Delete(id string) error
}
type Column ¶
type Column struct {
Name string `json:"name"`
DataType string `json:"data_type"`
Nullable bool `json:"nullable"`
Description string `json:"description,omitempty"`
DefaultValue string `json:"default_value,omitempty"`
PrimaryKey bool `json:"primary_key,omitempty"`
ForeignKey *FieldRef `json:"foreign_key,omitempty"`
}
type ConnectionRequest ¶
type ConnectionRequest struct {
// ID is the catalog id. Add ignores a client-supplied value; Update/Test use it to merge secrets.
ID string `json:"id,omitempty"`
Name string `json:"name"`
Engine string `json:"engine"`
Host string `json:"host"`
Port int `json:"port"`
Database string `json:"database"`
Username string `json:"username"`
Password string `json:"password"`
SSLMode string `json:"ssl_mode"`
DSN string `json:"dsn"`
SSH *SSHTunnelRequest `json:"ssh,omitempty"`
ClearSSH bool `json:"clear_ssh,omitempty"`
}
type ConnectionSecretStore ¶
type ConnectionSecretStore interface {
SaveConnectionSecret(string, ConnectionRequest) error
GetConnectionSecret(id string) (ConnectionRequest, error)
ListConnectionSecrets() (map[string]ConnectionRequest, error)
DeleteConnectionSecret(string) error
}
ConnectionSecretStore stores the connection settings required to reopen a catalog entry. Production implementations should use a managed secret store.
type Dashboard ¶
type Dashboard struct {
ID string `json:"id"`
CollectionID string `json:"collection_id,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
AutoRefreshSeconds int `json:"auto_refresh_seconds,omitempty"`
Appearance map[string]any `json:"appearance,omitempty"`
Tabs []DashboardTab `json:"tabs,omitempty"`
Cards []DashboardCard `json:"cards,omitempty"`
Filters []DashboardFilter `json:"filters,omitempty"`
ArchivedAt *time.Time `json:"archived_at,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
PublicUUID string `json:"public_uuid,omitempty"`
PublicEmbedEnabled bool `json:"public_embed_enabled"`
PublicExpiresAt *time.Time `json:"public_expires_at,omitempty"`
PublicPasswordHash string `json:"-"`
}
type DashboardCard ¶
type DashboardCard struct {
ID string `json:"id"`
DashboardID string `json:"dashboard_id,omitempty"`
TabID string `json:"tab_id,omitempty"`
Type string `json:"type"` // question | heading | text | link | iframe
QuestionID string `json:"question_id,omitempty"`
Title string `json:"title,omitempty"`
Body string `json:"body,omitempty"`
Config map[string]any `json:"config,omitempty"`
Click *ClickBehavior `json:"click,omitempty"`
Layout Layout `json:"layout"`
}
type DashboardFilter ¶
type DashboardFilter struct {
ID string `json:"id"`
DashboardID string `json:"dashboard_id,omitempty"`
Name string `json:"name"`
Type string `json:"type"` // date | category | id | number | text | boolean
Config map[string]any `json:"config,omitempty"`
Mappings []FilterMapping `json:"mappings,omitempty"`
}
type DashboardPublicAccess ¶
type DashboardPublicLinkUpdate ¶
type DashboardPublicLinkUpdate struct {
SetExpiry bool
ExpiresAt *time.Time
Password *string `json:"-"`
}
SetExpiry distinguishes an omitted expiry from an explicit return to a permanent link. Password follows the same convention (nil keeps it).
type DashboardStore ¶
type DashboardStore interface {
Create(Dashboard) error
Update(Dashboard) error
ByID(id string) (Dashboard, error)
ByPublicUUID(uuid string) (Dashboard, error)
SetPublicLink(id, publishUUID string, setExpiry bool, expiresAt *time.Time, passwordHash *string) error
ClearPublicLink(id string) error
SetEmbedding(id string, enabled bool) error
List(includeArchived bool) ([]Dashboard, error)
SetArchived(id string, archivedAt *time.Time) error
}
type DashboardTab ¶
type Database ¶
type Database struct {
ID string `json:"id"`
Name string `json:"name"`
Engine string `json:"engine"`
Host string `json:"host"`
Status string `json:"status"`
Connected bool `json:"connected"`
CreatedAt time.Time `json:"created_at"`
LastSyncedAt *time.Time `json:"last_synced_at,omitempty"`
TableCount int `json:"table_count,omitempty"`
}
type DatabaseConnector ¶
type DatabaseStore ¶
type DeveloperSettings ¶
type DeveloperSettings struct {
Enabled bool `json:"enabled"`
AllowPersonalKeys bool `json:"allow_personal_keys"`
AllowAnalysisWrite bool `json:"allow_analysis_write"`
DefaultKeyTTLDays int `json:"default_key_ttl_days"`
MaxQueryRows int `json:"max_query_rows"`
PublicBaseURL string `json:"public_base_url,omitempty"`
}
DeveloperSettings controls every non-browser API entry point. Developer mode is intentionally opt-in: disabling it invalidates all API keys at the authentication boundary without deleting them.
type ExternalIdentityLink ¶
type FieldMeta ¶
type FieldMeta struct {
DatabaseID string `json:"database_id"`
Schema string `json:"schema"`
Table string `json:"table"`
Name string `json:"name"`
DisplayName string `json:"display_name,omitempty"`
Description string `json:"description,omitempty"`
SemanticType string `json:"semantic_type,omitempty"`
Visibility string `json:"visibility,omitempty"`
Format map[string]any `json:"format,omitempty"`
FKTarget *FieldRef `json:"fk_target,omitempty"`
}
type FieldStore ¶
type FilterMapping ¶
type FilterValue ¶
type GlossaryStore ¶
type GlossaryStore interface {
Create(GlossaryTerm) error
List() ([]GlossaryTerm, error)
}
type GlossaryTerm ¶
type GroupStore ¶
type IdentityProvider ¶
type IdentityProvider struct {
ID string `json:"id"`
Type string `json:"type"` // feishu | dingtalk | wecom | oidc
Name string `json:"name"`
Enabled bool `json:"enabled"`
ClientID string `json:"client_id"`
ClientSecret string `json:"client_secret,omitempty"`
Configured bool `json:"configured,omitempty"`
AuthorizationURL string `json:"authorization_url"`
TokenURL string `json:"token_url"`
Scopes []string `json:"scopes,omitempty"`
GroupMappings map[string]string `json:"group_mappings,omitempty"` // external group ID -> Topbase group ID
}
IdentityProvider is deliberately provider-neutral. Each office suite can supply its OAuth endpoints and organisation-sync adapter without changing the user, group, or permission model.
type LineageEdge ¶
type LineageStore ¶
type LineageStore interface {
Add(LineageEdge) error
List(entityType, id string) ([]LineageEdge, error)
}
type MaterializeResult ¶
type MaterializeSpec ¶
type MaterializedTable ¶
type MaterializedTable struct {
ID string `json:"id"`
DatabaseID string `json:"database_id"`
Schema string `json:"schema"`
Name string `json:"name"`
ScheduleID string `json:"schedule_id,omitempty"`
QuestionID string `json:"question_id,omitempty"`
Warehouse bool `json:"warehouse"`
LastRunAt *time.Time `json:"last_run_at,omitempty"`
LastStatus string `json:"last_status,omitempty"`
RowCount int `json:"row_count,omitempty"`
Watermark string `json:"watermark,omitempty"`
}
type MaterializedTableStore ¶
type MaterializedTableStore interface {
Upsert(MaterializedTable) error
List() ([]MaterializedTable, error)
ListByDatabase(databaseID string) ([]MaterializedTable, error)
ByTarget(databaseID, schema, name string) (MaterializedTable, error)
}
type MetadataStore ¶
type MetadataStore interface {
GetTableAnnotation(databaseID, schema, table string) (TableAnnotation, error)
SaveTableAnnotation(databaseID, schema, table string, annotation TableAnnotation) error
}
type Metric ¶
type Metric struct {
ID string `json:"id"`
Name string `json:"name"`
DatabaseID string `json:"database_id"`
Schema string `json:"schema"`
Table string `json:"table"`
Aggregation queryir.Aggregation `json:"aggregation"`
Filters []queryir.Filter `json:"filters,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type MetricStore ¶
type Model ¶
type Model struct {
ID string `json:"id"`
CollectionID string `json:"collection_id,omitempty"`
Name string `json:"name"`
DatabaseID string `json:"database_id"`
QueryIR *queryir.Query `json:"queryir,omitempty"`
NativeSQL string `json:"native_sql,omitempty"`
Columns []ModelColumn `json:"columns,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type ModelColumn ¶
type ModelStore ¶
type Notification ¶
type NotificationStore ¶
type NotificationStore interface {
Create(Notification) error
List(userID string) ([]Notification, error)
ListAllNotifications() ([]Notification, error)
}
type PermissionGraph ¶
type ProjectAccessRule ¶
type ProjectAccessRule struct {
ProjectID string `json:"project_id"`
GroupID string `json:"group_id"`
Role string `json:"role"`
}
ProjectAccessRule grants a team group access to a team project. Roles are cumulative: view < edit < manage. Personal projects do not use these rules.
type QueryExecutor ¶
type QueryService ¶
type QueryService struct{ Executor QueryExecutor }
func (QueryService) Run ¶
func (s QueryService) Run(ctx context.Context, databaseID, sql string) (QueryResult, error)
func (QueryService) RunArgs ¶
func (s QueryService) RunArgs(ctx context.Context, databaseID, sql string, args []any) (QueryResult, error)
type Question ¶
type Question struct {
ID string `json:"id"`
CollectionID string `json:"collection_id,omitempty"`
DashboardID string `json:"dashboard_id,omitempty"`
Name string `json:"name"`
Description string `json:"description,omitempty"`
QueryIR *queryir.Query `json:"queryir,omitempty"`
NativeSQL string `json:"native_sql,omitempty"`
ChartSpec *ChartSpec `json:"chartspec,omitempty"`
QueryType string `json:"query_type"`
DatabaseID string `json:"database_id,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
ArchivedAt *time.Time `json:"archived_at,omitempty"`
Parameters []queryir.Parameter `json:"parameters,omitempty"`
RawQueryIR json.RawMessage `json:"-"`
}
type QuestionStore ¶
type RevisionStore ¶
type Run ¶
type Run struct {
ID string `json:"id"`
ScheduleID string `json:"schedule_id"`
Status string `json:"status"`
SQLCompiled string `json:"sql_compiled,omitempty"`
RowCount int `json:"row_count"`
Error string `json:"error,omitempty"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
}
type RunStore ¶
type RunStore interface {
Create(Run) error
Update(Run) error
List(scheduleID string) ([]Run, error)
Unconfirmed(scheduleID string) (Run, *MaterializedTable, error)
// Finish commits the final run, schedule timestamp and (when supplied)
// materialization metadata and lineage together.
Finish(Run, *MaterializedTable) error
// MarkUncertain may only change a run whose external write is pending.
MarkUncertain(Run, *MaterializedTable) error
}
type SSHTunnelRequest ¶
type SSHTunnelRequest struct {
Host string `json:"host"`
Port int `json:"port"`
Username string `json:"username"`
AuthenticationType string `json:"authentication_type,omitempty"`
Password string `json:"password,omitempty"`
PrivateKey string `json:"private_key,omitempty"`
PrivateKeyPassword string `json:"private_key_password,omitempty"`
HostKeyFingerprint string `json:"host_key_fingerprint"`
}
SSHTunnelRequest describes the bastion host, never the target database. HostKeyFingerprint is optional. When supplied, it must be the SHA256 fingerprint shown by the SSH server and will be verified.
type Schedule ¶
type Schedule struct {
ClaimedTarget bool `json:"-"`
ID string `json:"id"`
Name string `json:"name"`
QuestionID string `json:"question_id,omitempty"`
ModelID string `json:"model_id,omitempty"`
DatabaseID string `json:"database_id,omitempty"`
Cron string `json:"cron"`
Timezone string `json:"timezone,omitempty"`
MaterializeTo string `json:"materialize_to"`
Strategy string `json:"strategy,omitempty"`
WatermarkField string `json:"watermark_field,omitempty"`
ConfirmSourceWrite bool `json:"confirm_source_write,omitempty"`
Enabled bool `json:"enabled"`
LastRunAt *time.Time `json:"last_run_at,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type ScheduleProposal ¶
type ScheduleProposal struct {
Name string `json:"name"`
QuestionID string `json:"question_id"`
Cron string `json:"cron"`
Timezone string `json:"timezone"`
MaterializeTo string `json:"materialize_to"`
Strategy string `json:"strategy"`
WatermarkField string `json:"watermark_field,omitempty"`
RequiresConfirm bool `json:"requires_confirm"`
Rationale string `json:"rationale,omitempty"`
}
type ScheduleStore ¶
type ScheduleSummary ¶
type SchemaSnapshot ¶
type SchemaSnapshotStore ¶
type SchemaSnapshotStore interface {
SaveSnapshot(SchemaSnapshot) error
GetSnapshot(databaseID string) (SchemaSnapshot, error)
DeleteSnapshot(databaseID string) error
}
type SearchStore ¶
type SegmentStore ¶
type SemanticTypeOption ¶
type SessionStore ¶
type SettingStore ¶
type SetupRequest ¶
type Subscription ¶
type Subscription struct {
ID string `json:"id"`
DashboardID string `json:"dashboard_id"`
Cron string `json:"cron"`
Timezone string `json:"timezone,omitempty"`
Channel string `json:"channel"`
Enabled bool `json:"enabled"`
LastRunAt *time.Time `json:"last_run_at,omitempty"`
CreatedBy string `json:"created_by,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type SubscriptionStore ¶
type SubscriptionStore interface {
Create(Subscription) error
Update(Subscription) error
Delete(id string) error
ByID(id string) (Subscription, error)
ListByDashboard(dashboardID string) ([]Subscription, error)
List() ([]Subscription, error)
}
type TableAnnotation ¶
type UploadedTable ¶
type UploadedTable struct {
ID string `json:"id"`
Name string `json:"name"`
FileName string `json:"file_name"`
SheetName string `json:"sheet_name"`
Columns []Column `json:"columns"`
RowCount int `json:"row_count"`
CreatedAt time.Time `json:"created_at"`
}
UploadedTable is a user-provided workbook sheet retained by Topbase as part of its local warehouse. Rows are intentionally kept behind the store API; callers receive only safe catalog metadata.
type UploadedTablePreview ¶
type User ¶
type User struct {
ID string `json:"id"`
Email string `json:"email"`
Name string `json:"name"`
AvatarURL string `json:"avatar_url,omitempty"`
Locale string `json:"locale"`
Theme string `json:"theme"`
IsActive bool `json:"is_active"`
PasswordHash string `json:"-"`
FeishuOpenID string `json:"feishu_open_id,omitempty"`
IsAdmin bool `json:"is_admin,omitempty"`
CreatedAt time.Time `json:"created_at"`
}
type UserStore ¶
type UserStore interface {
Create(User) error
ByEmail(email string) (User, error)
ByID(id string) (User, error)
ByFeishuOpenID(openID string) (User, error)
List() ([]User, error)
SetActive(id string, active bool) error
SetPassword(id, passwordHash string) error
UpdateProfile(id, name, email, locale, theme, avatarURL string) error
}
type WarehouseWriter ¶
type WarehouseWriter interface {
Materialize(ctx context.Context, spec MaterializeSpec) (MaterializeResult, error)
}
type WebhookEndpoint ¶
type WebhookEndpoint struct {
ID string `json:"id"`
Name string `json:"name"`
Provider string `json:"provider"` // feishu | dingtalk | wecom | slack | teams | google_chat | generic
URL string `json:"url"`
Secret string `json:"secret,omitempty"`
TemplateType string `json:"template_type,omitempty"` // text | post | card | custom
Template string `json:"template,omitempty"` // custom JSON or legacy preset JSON
TemplateTitle string `json:"template_title,omitempty"`
TemplateBody string `json:"template_body,omitempty"`
Enabled bool `json:"enabled"`
CreatedAt time.Time `json:"created_at"`
}