Versions in this module Expand all Collapse all v0 v0.2.7 Nov 28, 2026 v0.2.6 Nov 27, 2026 Changes in this version + var ErrNotFound = errors.New("not found") + var ErrWarehouseCommitUnknown = errors.New("目标库提交结果未确认") + var ErrWarehouseTargetInUse = errors.New("已有沉淀计划或数据表使用此目标,请更换保存表名") + var SemanticTypeOptions = []SemanticTypeOption + var SemanticTypes = []string + 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 interface + Ask func(context.Context, string, string) (ChatResponse, error) + type APIKey struct + CreatedAt time.Time + ExpiresAt *time.Time + Hash string + ID string + Key string + Name string + Prefix string + UserID string + type APIKeyStore interface + ByHash func(hash string) (APIKey, error) + Create func(APIKey) error + Delete func(id string) error + List func() ([]APIKey, error) + ListByUser func(userID string) ([]APIKey, error) + type AdminSettings struct + CustomDomain string + EmbeddingEnabled bool + PublicPort int + PublicScheme string + PublicSharingEnabled bool + SiteName string + Timezone string + type Alert struct + Channel string + CreatedAt time.Time + CreatedBy string + Cron string + Enabled bool + Goal float64 + ID string + Kind string + Name string + Once bool + QuestionID string + type AlertStore interface + ByID func(id string) (Alert, error) + Create func(Alert) error + Delete func(id string) error + List func() ([]Alert, error) + Update func(Alert) error + type AuthSettings struct + EnabledProviderIDs []string + PasswordLoginEnabled bool + type Bookmark struct + CreatedAt time.Time + ID string + Name string + TargetID string + TargetType string + UserID string + type BookmarkStore interface + Create func(Bookmark) error + Delete func(id, userID string) error + ListByUser func(userID string) ([]Bookmark, error) + type CatalogService struct + Connector DatabaseConnector + Secrets ConnectionSecretStore + Snapshots SchemaSnapshotStore + Store DatabaseStore + 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 struct + AutoRange *bool + Enabled string + Labels *bool + Max *float64 + Min *float64 + Scale string + Ticks *int + Title string + UnpinZero bool + type ChartColorSegment struct + Color string + Max *float64 + Min *float64 + type ChartColumnStyle struct + Filter string + Title string + Visible *bool + type ChartSeriesStyle struct + Axis string + Color string + Display string + Interpolate string + LineSize string + LineStyle string + Markers string + Missing string + ShowTrend *bool + ShowValues *bool + Title string + Visible *bool + type ChartSpec struct + AutoSplit *bool + Breakout string + Color string + Columns map[string]ChartColumnStyle + Decimals *int + Donut *bool + Goal *float64 + GoalLabel string + Interpolation string + LabelFrequency string + Legend string + Markers string + MaxCategories int + Missing string + Multiply *float64 + NumberStyle string + OtherColor string + Percent string + Prefix string + Search string + Segments []ChartColorSegment + Series map[string]ChartSeriesStyle + ShowGoal *bool + ShowLabels bool + ShowLegend *bool + ShowTotal *bool + SliceThreshold *float64 + Smooth *bool + Sort string + SortDir string + StackValues string + Stacked bool + Stacking string + Suffix string + Trendline bool + Type string + ValueFormat string + X string + XAxis *ChartAxisSpec + XTitle string + Y []string + YAxis *ChartAxisSpec + YTitle string + type ChatRequest struct + DatabaseID string + Message string + type ChatResponse struct + Answer string + SQL string + Safe bool + type ClickBehavior struct + DashboardID string + FilterID string + QuestionID string + Type string + URL string + type Collection struct + CreatedAt time.Time + ID string + Kind string + Name string + OwnerGroupID string + ParentID string + PersonalOwnerUserID string + ReadOnly bool + SharedByName string + type CollectionShare struct + CollectionID string + CreatedAt time.Time + UserID string + type CollectionStore interface + ByID func(id string) (Collection, error) + Create func(Collection) error + Delete func(id string) error + List func() ([]Collection, error) + Update func(Collection) error + type Column struct + DataType string + DefaultValue string + Description string + ForeignKey *FieldRef + Name string + Nullable bool + PrimaryKey bool + type ConnectionRequest struct + ClearSSH bool + DSN string + Database string + Engine string + Host string + ID string + Name string + Password string + Port int + SSH *SSHTunnelRequest + SSLMode string + Username string + type ConnectionSecretStore interface + DeleteConnectionSecret func(string) error + GetConnectionSecret func(id string) (ConnectionRequest, error) + ListConnectionSecrets func() (map[string]ConnectionRequest, error) + SaveConnectionSecret func(string, ConnectionRequest) error + type Dashboard struct + Appearance map[string]any + ArchivedAt *time.Time + AutoRefreshSeconds int + Cards []DashboardCard + CollectionID string + CreatedAt time.Time + CreatedBy string + Description string + Filters []DashboardFilter + ID string + Name string + PublicEmbedEnabled bool + PublicExpiresAt *time.Time + PublicPasswordHash string + PublicUUID string + Tabs []DashboardTab + type DashboardCard struct + Body string + Click *ClickBehavior + Config map[string]any + DashboardID string + ID string + Layout Layout + QuestionID string + TabID string + Title string + Type string + type DashboardFilter struct + Config map[string]any + DashboardID string + ID string + Mappings []FilterMapping + Name string + Type string + type DashboardPublicAccess struct + EmbedEnabled bool + ExpiresAt *time.Time + PasswordHash string + type DashboardPublicLinkUpdate struct + ExpiresAt *time.Time + Password *string + SetExpiry bool + type DashboardStore interface + ByID func(id string) (Dashboard, error) + ByPublicUUID func(uuid string) (Dashboard, error) + ClearPublicLink func(id string) error + Create func(Dashboard) error + List func(includeArchived bool) ([]Dashboard, error) + SetArchived func(id string, archivedAt *time.Time) error + SetEmbedding func(id string, enabled bool) error + SetPublicLink func(id, publishUUID string, setExpiry bool, expiresAt *time.Time, ...) error + Update func(Dashboard) error + type DashboardTab struct + DashboardID string + ID string + Name string + Position int + type Database struct + Connected bool + CreatedAt time.Time + Engine string + Host string + ID string + LastSyncedAt *time.Time + Name string + Status string + TableCount int + type DatabaseConnector interface + Close func(string) error + Connect func(context.Context, ConnectionRequest) (Database, error) + Connected func(id string) bool + Tables func(context.Context, string) ([]Table, error) + type DatabaseStore interface + Delete func(string) error + List func() ([]Database, error) + Save func(Database) error + type DeveloperSettings struct + AllowAnalysisWrite bool + AllowPersonalKeys bool + DefaultKeyTTLDays int + Enabled bool + MaxQueryRows int + PublicBaseURL string + type ExternalIdentityLink struct + ProviderID string + Subject string + UserID string + type FieldMeta struct + DatabaseID string + Description string + DisplayName string + FKTarget *FieldRef + Format map[string]any + Name string + Schema string + SemanticType string + Table string + Visibility string + type FieldRef struct + Name string + Schema string + Table string + type FieldStore interface + ListDatabaseFields func(databaseID string) ([]FieldMeta, error) + ListFields func(databaseID, schema, table string) ([]FieldMeta, error) + SaveField func(FieldMeta) error + type FilterMapping struct + CardID string + Field string + type FilterValue map[string]any + type GlossaryStore interface + Create func(GlossaryTerm) error + List func() ([]GlossaryTerm, error) + type GlossaryTerm struct + Definition string + ID string + Name string + type Group struct + ID string + Kind string + MemberIDs []string + Name string + type GroupStore interface + AddMember func(groupID, userID string) error + Create func(Group) error + GroupsForUser func(userID string) ([]Group, error) + HasMember func(groupID, userID string) (bool, error) + List func() ([]Group, error) + ReplaceMembers func(groupID string, userIDs []string) error + Upsert func(Group) error + type IdentityProvider struct + AuthorizationURL string + ClientID string + ClientSecret string + Configured bool + Enabled bool + GroupMappings map[string]string + ID string + Name string + Scopes []string + TokenURL string + Type string + type Layout struct + H float64 + W float64 + X float64 + Y float64 + type LineageEdge struct + FromID string + FromType string + ToID string + ToType string + type LineageStore interface + Add func(LineageEdge) error + List func(entityType, id string) ([]LineageEdge, error) + type MaterializeResult struct + RowCount int + Watermark string + type MaterializeSpec struct + Args []any + DatabaseID string + RequireNewTarget bool + SQL string + Schema string + Strategy string + Table string + WatermarkField string + type MaterializedTable struct + DatabaseID string + ID string + LastRunAt *time.Time + LastStatus string + Name string + QuestionID string + RowCount int + ScheduleID string + Schema string + Warehouse bool + Watermark string + type MaterializedTableStore interface + ByTarget func(databaseID, schema, name string) (MaterializedTable, error) + List func() ([]MaterializedTable, error) + ListByDatabase func(databaseID string) ([]MaterializedTable, error) + Upsert func(MaterializedTable) error + type MetadataStore interface + GetTableAnnotation func(databaseID, schema, table string) (TableAnnotation, error) + SaveTableAnnotation func(databaseID, schema, table string, annotation TableAnnotation) error + type Metric struct + Aggregation queryir.Aggregation + CreatedAt time.Time + DatabaseID string + Filters []queryir.Filter + ID string + Name string + Schema string + Table string + type MetricStore interface + ByID func(id string) (Metric, error) + Create func(Metric) error + List func() ([]Metric, error) + type Model struct + CollectionID string + Columns []ModelColumn + CreatedAt time.Time + CreatedBy string + DatabaseID string + ID string + Name string + NativeSQL string + QueryIR *queryir.Query + type ModelColumn struct + Description string + DisplayName string + Name string + SemanticType string + type ModelStore interface + ByID func(id string) (Model, error) + Create func(Model) error + List func() ([]Model, error) + Update func(Model) error + type Notification struct + AlertID string + Body string + CreatedAt time.Time + ID string + ReadAt *time.Time + Title string + UserID string + type NotificationStore interface + Create func(Notification) error + List func(userID string) ([]Notification, error) + ListAllNotifications func() ([]Notification, error) + type OrgDirectory interface + ListUnits func(context.Context) ([]OrgUnit, error) + type OrgUnit struct + ExternalID string + MemberIDs []string + Name string + type PermissionGraph struct + CollectionGraph map[string]any + DataGraph map[string]any + Revision int + type ProjectAccessRule struct + GroupID string + ProjectID string + Role string + type QueryExecutor interface + Execute func(ctx context.Context, databaseID, sql string, args ...any) (QueryResult, error) + type QueryResult struct + Columns []string + Meta map[string]any + Rows [][]any + type QueryService struct + Executor QueryExecutor + func (s QueryService) Run(ctx context.Context, databaseID, sql string) (QueryResult, error) + func (s QueryService) RunArgs(ctx context.Context, databaseID, sql string, args []any) (QueryResult, error) + type Question struct + ArchivedAt *time.Time + ChartSpec *ChartSpec + CollectionID string + CreatedAt time.Time + CreatedBy string + DashboardID string + DatabaseID string + Description string + ID string + Name string + NativeSQL string + Parameters []queryir.Parameter + QueryIR *queryir.Query + QueryType string + RawQueryIR json.RawMessage + type QuestionStore interface + ByID func(id string) (Question, error) + Create func(Question) error + List func(includeArchived bool) ([]Question, error) + SetArchived func(id string, archivedAt *time.Time) error + Update func(Question) error + type Revision struct + ActorID string + CreatedAt time.Time + ID string + Snapshot string + TargetID string + TargetType string + type RevisionStore interface + Create func(Revision) error + List func(targetType, targetID string) ([]Revision, error) + type Run struct + Error string + FinishedAt *time.Time + ID string + RowCount int + SQLCompiled string + ScheduleID string + StartedAt time.Time + Status string + type RunStore interface + Create func(Run) error + Finish func(Run, *MaterializedTable) error + List func(scheduleID string) ([]Run, error) + MarkUncertain func(Run, *MaterializedTable) error + Unconfirmed func(scheduleID string) (Run, *MaterializedTable, error) + Update func(Run) error + type SSHTunnelRequest struct + AuthenticationType string + Host string + HostKeyFingerprint string + Password string + Port int + PrivateKey string + PrivateKeyPassword string + Username string + type Schedule struct + ClaimedTarget bool + ConfirmSourceWrite bool + CreatedAt time.Time + CreatedBy string + Cron string + DatabaseID string + Enabled bool + ID string + LastRunAt *time.Time + MaterializeTo string + ModelID string + Name string + QuestionID string + Strategy string + Timezone string + WatermarkField string + type ScheduleProposal struct + Cron string + MaterializeTo string + Name string + QuestionID string + Rationale string + RequiresConfirm bool + Strategy string + Timezone string + WatermarkField string + type ScheduleStore interface + ByID func(id string) (Schedule, error) + Create func(Schedule) error + List func() ([]Schedule, error) + Update func(Schedule) error + type ScheduleSummary struct + LastError string + LastStatus string + type SchemaSnapshot struct + DatabaseID string + SyncedAt time.Time + Tables []Table + type SchemaSnapshotStore interface + DeleteSnapshot func(databaseID string) error + GetSnapshot func(databaseID string) (SchemaSnapshot, error) + SaveSnapshot func(SchemaSnapshot) error + type SearchHit struct + ID string + Name string + Type string + type SearchStore interface + Search func(query string) ([]SearchHit, error) + type Segment struct + CreatedAt time.Time + DatabaseID string + Filters []queryir.Filter + ID string + Name string + Schema string + Table string + type SegmentStore interface + ByID func(id string) (Segment, error) + Create func(Segment) error + List func() ([]Segment, error) + type SemanticTypeOption struct + Label string + Sensitive bool + Value string + type Session struct + ExpiresAt time.Time + ID string + UserID string + type SessionStore interface + ByID func(id string) (Session, error) + Create func(Session) error + Delete func(id string) error + DeleteExpired func(now time.Time) error + type SettingStore interface + Get func(key string) (string, bool, error) + Set func(key, value string) error + type SetupRequest struct + AdminEmail string + AdminName string + AdminPassword string + Language string + SiteName string + type Subscription struct + Channel string + CreatedAt time.Time + CreatedBy string + Cron string + DashboardID string + Enabled bool + ID string + LastRunAt *time.Time + Timezone string + type SubscriptionStore interface + ByID func(id string) (Subscription, error) + Create func(Subscription) error + Delete func(id string) error + List func() ([]Subscription, error) + ListByDashboard func(dashboardID string) ([]Subscription, error) + Update func(Subscription) error + type Table struct + Columns []Column + Description string + Name string + Schema string + type TableAnnotation struct + Description string + DisplayName string + FieldTypes map[string]string + Hidden bool + UserNote string + type TrashItem struct + ArchivedAt time.Time + ID string + Name string + Type string + type UploadedTable struct + Columns []Column + CreatedAt time.Time + FileName string + ID string + Name string + RowCount int + SheetName string + type UploadedTablePreview struct + ByteLimited bool + Rows [][]string + TotalRows int + type User struct + AvatarURL string + CreatedAt time.Time + Email string + FeishuOpenID string + ID string + IsActive bool + IsAdmin bool + Locale string + Name string + PasswordHash string + Theme string + type UserStore interface + ByEmail func(email string) (User, error) + ByFeishuOpenID func(openID string) (User, error) + ByID func(id string) (User, error) + Create func(User) error + List func() ([]User, error) + SetActive func(id string, active bool) error + SetPassword func(id, passwordHash string) error + UpdateProfile func(id, name, email, locale, theme, avatarURL string) error + type WarehouseWriter interface + Materialize func(ctx context.Context, spec MaterializeSpec) (MaterializeResult, error) + type WebhookEndpoint struct + CreatedAt time.Time + Enabled bool + ID string + Name string + Provider string + Secret string + Template string + TemplateBody string + TemplateTitle string + TemplateType string + URL string