models

package
v0.0.0-...-caaa3fa Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AIBusinessEntity

type AIBusinessEntity struct {
	ID              int             `json:"id" gorm:"primaryKey"`
	UUID            string          `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID     *string         `json:"referenceid" gorm:"uniqueIndex"`
	ConfigID        int             `json:"config_id" gorm:"not null"`
	EntityName      string          `json:"entity_name" gorm:"not null"`
	EntityType      string          `json:"entity_type"`
	Description     string          `json:"description" gorm:"not null"`
	DatabaseAlias   *string         `json:"database_alias"`
	SchemaName      *string         `json:"schema_name"`
	MappedTableName *string         `json:"table_name" gorm:"column:table_name"`
	FieldMappings   json.RawMessage `json:"field_mappings" gorm:"type:jsonb"`
	Relationships   json.RawMessage `json:"relationships" gorm:"type:jsonb"`
	BusinessRules   json.RawMessage `json:"business_rules" gorm:"type:jsonb"`
	Metadata        json.RawMessage `json:"metadata" gorm:"type:jsonb"`
	Embedding       Vector          `json:"embedding,omitempty" gorm:"type:vector"`
	EmbeddingHash   string          `json:"embedding_hash"`
	GeneratedAt     time.Time       `json:"generated_at"`
	Active          bool            `json:"active" gorm:"default:true"`
	CreatedBy       string          `json:"createdby" gorm:"not null"`
	CreatedOn       time.Time       `json:"createdon" gorm:"default:CURRENT_TIMESTAMP"`
	ModifiedBy      *string         `json:"modifiedby"`
	ModifiedOn      *time.Time      `json:"modifiedon"`
	RowVersionStamp int             `json:"rowversionstamp" gorm:"default:1"`
}

AIBusinessEntity stores business entity definitions with embeddings (IAC Standard)

func (AIBusinessEntity) TableName

func (AIBusinessEntity) TableName() string

TableName specifies the table name for GORM

type AIConversationSession

type AIConversationSession struct {
	ID          int    `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
	SessionID   string `json:"session_id" gorm:"column:session_id;type:varchar(36);not null;uniqueIndex"`
	UserID      string `json:"user_id" gorm:"column:user_id;type:varchar(36);not null"`
	EditorType  string `json:"editor_type" gorm:"column:editor_type;type:varchar(50)"` // bpm, page, view, workflow, whiteboard, report, general
	ContextData string `json:"context_data" gorm:"column:context_data;type:text"`      // JSON serialized conversation context

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

AIConversationSession represents a conversation session for AI agency

func (AIConversationSession) TableName

func (AIConversationSession) TableName() string

TableName specifies the table name

type AIEmbeddingConfiguration

type AIEmbeddingConfiguration struct {
	ID                   int             `json:"id" gorm:"primaryKey"`
	UUID                 string          `json:"uuid" gorm:"column:uuid;type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID          *string         `json:"referenceid" gorm:"column:referenceid;uniqueIndex"`
	ConfigName           string          `json:"config_name" gorm:"column:config_name;uniqueIndex;not null"`
	EmbeddingModel       string          `json:"embedding_model" gorm:"column:embedding_model;not null"`
	EmbeddingDimensions  int             `json:"embedding_dimensions" gorm:"column:embedding_dimensions;not null"`
	VectorDatabaseType   string          `json:"vector_database_type" gorm:"column:vector_database_type;default:postgresql"`
	VectorDatabaseConfig json.RawMessage `json:"vector_database_config" gorm:"column:vector_database_config;type:jsonb"`
	Active               bool            `json:"active" gorm:"column:active;default:true"`
	CreatedBy            string          `json:"createdby" gorm:"column:createdby;not null"`
	CreatedOn            time.Time       `json:"createdon" gorm:"column:createdon;default:CURRENT_TIMESTAMP"`
	ModifiedBy           *string         `json:"modifiedby" gorm:"column:modifiedby"`
	ModifiedOn           *time.Time      `json:"modifiedon" gorm:"column:modifiedon"`
	RowVersionStamp      int             `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

AIEmbeddingConfiguration stores AI configuration metadata (IAC Standard)

func (AIEmbeddingConfiguration) TableName

func (AIEmbeddingConfiguration) TableName() string

TableName specifies the table name for GORM

type AIGenerationLog

type AIGenerationLog struct {
	ID              string         `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	ConversationID  *string        `json:"conversationid" gorm:"column:conversationid;type:varchar(36)"`
	MessageID       *string        `json:"messageid" gorm:"column:messageid;type:varchar(36)"`
	GenerationType  GenerationType `json:"generationtype" gorm:"column:generationtype;type:enum('sql','report','narrative','chart');not null"`
	InputPrompt     string         `json:"inputprompt" gorm:"column:inputprompt;type:text"`
	SystemPrompt    string         `json:"systemprompt" gorm:"column:systemprompt;type:text"`
	AIResponse      string         `json:"airesponse" gorm:"column:airesponse;type:text"`
	ModelName       string         `json:"modelname" gorm:"column:modelname;type:varchar(100)"`
	TokensUsed      *int           `json:"tokensused" gorm:"column:tokensused"`
	LatencyMs       *int           `json:"latencyms" gorm:"column:latencyms"`
	ConfidenceScore *float64       `json:"confidencescore" gorm:"column:confidencescore;type:decimal(3,2)"`
	WasSuccessful   bool           `json:"wassuccessful" gorm:"column:wassuccessful;default:true"`
	ErrorMessage    string         `json:"errormessage" gorm:"column:errormessage;type:text"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

AIGenerationLog represents audit log for AI-generated content

func (AIGenerationLog) TableName

func (AIGenerationLog) TableName() string

TableName specifies the table name

type AIQueryTemplate

type AIQueryTemplate struct {
	ID                    int             `json:"id" gorm:"primaryKey"`
	UUID                  string          `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID           *string         `json:"referenceid" gorm:"uniqueIndex"`
	ConfigID              int             `json:"config_id" gorm:"not null"`
	TemplateName          string          `json:"template_name" gorm:"not null"`
	TemplateCategory      string          `json:"template_category"`
	NaturalLanguageQuery  string          `json:"natural_language_query" gorm:"not null"`
	SQLTemplate           string          `json:"sql_template" gorm:"not null"`
	Parameters            json.RawMessage `json:"parameters" gorm:"type:jsonb"`
	DatabaseAlias         *string         `json:"database_alias"`
	EntitiesUsed          json.RawMessage `json:"entities_used" gorm:"type:jsonb"`
	ExampleQueries        json.RawMessage `json:"example_queries" gorm:"type:jsonb"`
	ExpectedResultsSchema json.RawMessage `json:"expected_results_schema" gorm:"type:jsonb"`
	UsageCount            int             `json:"usage_count" gorm:"default:0"`
	LastUsedAt            *time.Time      `json:"last_used_at"`
	Embedding             Vector          `json:"embedding,omitempty" gorm:"type:vector"`
	EmbeddingHash         string          `json:"embedding_hash"`
	GeneratedAt           time.Time       `json:"generated_at"`
	Active                bool            `json:"active" gorm:"default:true"`
	CreatedBy             string          `json:"createdby" gorm:"not null"`
	CreatedOn             time.Time       `json:"createdon" gorm:"default:CURRENT_TIMESTAMP"`
	ModifiedBy            *string         `json:"modifiedby"`
	ModifiedOn            *time.Time      `json:"modifiedon"`
	RowVersionStamp       int             `json:"rowversionstamp" gorm:"default:1"`
}

AIQueryTemplate stores SQL query templates with embeddings (IAC Standard)

func (AIQueryTemplate) TableName

func (AIQueryTemplate) TableName() string

TableName specifies the table name for GORM

type BarcodeType

type BarcodeType string

BarcodeType represents the type of barcode

const (
	BarcodeTypeCode128    BarcodeType = "code128"
	BarcodeTypeCode39     BarcodeType = "code39"
	BarcodeTypeEAN13      BarcodeType = "ean13"
	BarcodeTypeEAN8       BarcodeType = "ean8"
	BarcodeTypeUPC        BarcodeType = "upc"
	BarcodeTypeQRCode     BarcodeType = "qr_code"
	BarcodeTypeDataMatrix BarcodeType = "data_matrix"
	BarcodeTypePDF417     BarcodeType = "pdf417"
	BarcodeTypeAztec      BarcodeType = "aztec"
)

type BusinessEntity

type BusinessEntity struct {
	ID            int          `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
	UUID          string       `json:"uuid" gorm:"column:uuid;type:uuid;not null;uniqueIndex"`
	ReferenceID   string       `json:"referenceid" gorm:"column:referenceid;type:varchar(255);uniqueIndex"`
	ConfigID      int          `json:"config_id" gorm:"column:config_id;not null"`
	EntityName    string       `json:"entity_name" gorm:"column:entity_name;type:varchar(255);not null"`
	EntityType    string       `json:"entity_type" gorm:"column:entity_type;type:varchar(100)"`
	Description   string       `json:"description" gorm:"column:description;type:text;not null"`
	DatabaseAlias string       `json:"database_alias" gorm:"column:database_alias;type:varchar(255)"`
	SchemaName    string       `json:"schema_name" gorm:"column:schema_name;type:varchar(255)"`
	Table         string       `json:"table_name" gorm:"column:table_name;type:varchar(255)"`
	FieldMappings JSONMap      `json:"field_mappings" gorm:"column:field_mappings;type:jsonb"`
	Relationships JSONMap      `json:"relationships" gorm:"column:relationships;type:jsonb"`
	BusinessRules JSONMap      `json:"business_rules" gorm:"column:business_rules;type:jsonb"`
	Metadata      JSONMap      `json:"metadata" gorm:"column:metadata;type:jsonb"`
	Embedding     VectorArray  `json:"embedding,omitempty" gorm:"column:embedding;type:vector"`
	EmbeddingHash string       `json:"embedding_hash" gorm:"column:embedding_hash;type:varchar(64)"`
	GeneratedAt   sql.NullTime `json:"generated_at" gorm:"column:generated_at;default:CURRENT_TIMESTAMP"`

	// Standard IAC audit fields
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(255);not null"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;default:CURRENT_TIMESTAMP"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(255)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

BusinessEntity represents business-level entity mappings

func (BusinessEntity) TableName

func (BusinessEntity) TableName() string

TableName specifies the table name

type BusinessEntityRequest

type BusinessEntityRequest struct {
	ConfigID      int                    `json:"config_id" binding:"required"`
	EntityName    string                 `json:"entity_name" binding:"required"`
	EntityType    string                 `json:"entity_type"`
	Description   string                 `json:"description" binding:"required"`
	DatabaseAlias *string                `json:"database_alias"`
	SchemaName    *string                `json:"schema_name"`
	TableName     *string                `json:"table_name"`
	FieldMappings map[string]interface{} `json:"field_mappings"`
	Relationships map[string]interface{} `json:"relationships"`
	BusinessRules map[string]interface{} `json:"business_rules"`
}

BusinessEntityRequest represents request to create/update business entity

type BusinessEntityType

type BusinessEntityType string

BusinessEntityType represents the type of business entity

const (
	BusinessEntityTypeEntity    BusinessEntityType = "entity"
	BusinessEntityTypeMetric    BusinessEntityType = "metric"
	BusinessEntityTypeDimension BusinessEntityType = "dimension"
)

type ChartType

type ChartType string

ChartType represents the type of chart

const (
	ChartTypeLine        ChartType = "line"
	ChartTypeBar         ChartType = "bar"
	ChartTypePie         ChartType = "pie"
	ChartTypeArea        ChartType = "area"
	ChartTypeScatter     ChartType = "scatter"
	ChartTypeDonut       ChartType = "donut"
	ChartTypeStackedBar  ChartType = "stacked_bar"
	ChartTypeStackedArea ChartType = "stacked_area"
	ChartTypeBar3D       ChartType = "bar_3d"
	ChartTypePie3D       ChartType = "pie_3d"
	ChartTypeLine3D      ChartType = "line_3d"
)

type ChatMessage

type ChatMessage struct {
	ID              string      `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	ConversationID  string      `json:"conversationid" gorm:"column:conversationid;type:varchar(36);not null"`
	MessageType     MessageType `json:"messagetype" gorm:"column:messagetype;type:enum('user','assistant');default:'user'"`
	Text            string      `json:"text" gorm:"column:text;type:text;not null"`
	SQLQuery        string      `json:"sqlquery" gorm:"column:sqlquery;type:text"`
	SQLConfidence   *float64    `json:"sqlconfidence" gorm:"column:sqlconfidence;type:decimal(3,2)"`
	ResultData      JSONMap     `json:"resultdata" gorm:"column:resultdata;type:json"`
	RowCount        *int        `json:"rowcount" gorm:"column:rowcount"`
	ExecutionTimeMs *int        `json:"executiontimems" gorm:"column:executiontimems"`
	ErrorMessage    string      `json:"errormessage" gorm:"column:errormessage;type:text"`
	ChartMetadata   JSONMap     `json:"chartmetadata" gorm:"column:chartmetadata;type:json"`
	Provenance      JSONMap     `json:"provenance" gorm:"column:provenance;type:json"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ChatMessage represents a message in a conversation

func (ChatMessage) TableName

func (ChatMessage) TableName() string

TableName specifies the table name

type ComponentType

type ComponentType string

ComponentType represents the type of report component

const (
	ComponentTypeTable      ComponentType = "table"
	ComponentTypeChart      ComponentType = "chart"
	ComponentTypeBarcode    ComponentType = "barcode"
	ComponentTypeSubReport  ComponentType = "sub_report"
	ComponentTypeText       ComponentType = "text"
	ComponentTypeImage      ComponentType = "image"
	ComponentTypeDrillDown  ComponentType = "drill_down"
	ComponentTypePageBreak  ComponentType = "page-break"
	ComponentTypePageHeader ComponentType = "page-header"
	ComponentTypePageFooter ComponentType = "page-footer"
)

type Conversation

type Conversation struct {
	ID               string `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	Title            string `json:"title" gorm:"column:title;type:varchar(255);not null"`
	UserID           string `json:"userid" gorm:"column:userid;type:varchar(36);not null"`
	DatabaseAlias    string `json:"databasealias" gorm:"column:databasealias;type:varchar(100)"`
	AutoExecuteQuery bool   `json:"autoexecutequery" gorm:"column:autoexecutequery;default:true"`

	// Relationships
	Messages []ChatMessage `json:"messages,omitempty" gorm:"foreignKey:ConversationID;constraint:OnDelete:CASCADE"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

Conversation represents a chat conversation thread

func (Conversation) TableName

func (Conversation) TableName() string

TableName specifies the table name

type DatabaseSchemaEmbedding

type DatabaseSchemaEmbedding struct {
	ID              int             `json:"id" gorm:"primaryKey"`
	UUID            string          `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID     *string         `json:"referenceid" gorm:"column:referenceid;uniqueIndex"`
	ConfigID        int             `json:"config_id" gorm:"column:config_id;not null"`
	DatabaseAlias   string          `json:"database_alias" gorm:"column:database_alias;not null"`
	SchemaName      string          `json:"schema_name" gorm:"column:schema_name;not null"`
	MappedTableName string          `json:"table_name" gorm:"column:table_name;not null"`
	ColumnName      *string         `json:"column_name" gorm:"column:column_name"`
	Description     string          `json:"description" gorm:"column:description"`
	Metadata        json.RawMessage `json:"metadata" gorm:"column:metadata;type:jsonb"`
	Embedding       Vector          `json:"embedding,omitempty" gorm:"column:embedding;type:vector"`
	EmbeddingHash   string          `json:"embedding_hash" gorm:"column:embedding_hash"`
	GeneratedAt     time.Time       `json:"generated_at" gorm:"column:generated_at"`
	Active          bool            `json:"active" gorm:"column:active;default:true"`
	CreatedBy       string          `json:"createdby" gorm:"column:createdby;not null"`
	CreatedOn       time.Time       `json:"createdon" gorm:"column:createdon;default:CURRENT_TIMESTAMP"`
	ModifiedBy      *string         `json:"modifiedby" gorm:"column:modifiedby"`
	ModifiedOn      *time.Time      `json:"modifiedon" gorm:"column:modifiedon"`
	RowVersionStamp int             `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

DatabaseSchemaEmbedding stores vector embeddings for database schema metadata (IAC Standard)

func (DatabaseSchemaEmbedding) TableName

func (DatabaseSchemaEmbedding) TableName() string

TableName specifies the table name for GORM

type DatabaseSchemaMetadata

type DatabaseSchemaMetadata struct {
	ID            string       `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	DatabaseAlias string       `json:"database_alias" gorm:"column:databasealias;type:varchar(100);not null"`
	SchemaName    string       `json:"schema_name" gorm:"column:schemaname;type:varchar(100)"`
	Table         string       `json:"table_name" gorm:"column:tablename;type:varchar(100);not null"`
	Column        string       `json:"column_name" gorm:"column:columnname;type:varchar(100)"`
	DataType      string       `json:"data_type" gorm:"column:datatype;type:varchar(50)"`
	IsNullable    *bool        `json:"is_nullable" gorm:"column:isnullable"`
	IsPrimaryKey  *bool        `json:"is_primary_key" gorm:"column:is_primary_key"`
	IsForeignKey  *bool        `json:"is_foreign_key" gorm:"column:is_foreign_key"`
	ColumnComment string       `json:"column_comment" gorm:"column:columncomment;type:text"`
	SampleValues  JSONMap      `json:"sample_values" gorm:"column:samplevalues;type:json"`
	MetadataType  MetadataType `json:"entity_type" gorm:"column:metadatatype;type:enum('table','column');not null"`
	Description   string       `json:"description" gorm:"column:description;type:text"`
	BusinessName  string       `json:"business_name" gorm:"column:business_name;type:varchar(255)"`
	BusinessTerms JSONMap      `json:"business_terms" gorm:"column:businessterms;type:json"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"reference_id" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"created_by" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"created_at" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modified_by" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"updated_at" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"row_version_stamp" gorm:"column:rowversionstamp;default:1"`
}

DatabaseSchemaMetadata represents database schema information

func (DatabaseSchemaMetadata) TableName

func (DatabaseSchemaMetadata) TableName() string

TableName specifies the table name

type DatabaseSchemaMetadataSummary

type DatabaseSchemaMetadataSummary struct {
	DatabaseAlias           string     `json:"database_alias"`
	SchemaName              string     `json:"schema_name"`
	TableName               string     `json:"table_name"`
	HasTableDescription     int        `json:"has_table_description"`
	ColumnsWithDescriptions int        `json:"columns_with_descriptions"`
	LastUpdated             *time.Time `json:"last_updated"`
}

DatabaseSchemaMetadataSummary holds summary of database schema metadata

type EmbeddingConfigStats

type EmbeddingConfigStats struct {
	ID                           int        `json:"id"`
	UUID                         string     `json:"uuid"`
	ConfigName                   string     `json:"config_name"`
	EmbeddingModel               string     `json:"embedding_model"`
	EmbeddingDimensions          int        `json:"embedding_dimensions"`
	VectorDatabaseType           string     `json:"vector_database_type"`
	Active                       bool       `json:"active"`
	CreatedOn                    time.Time  `json:"createdon"`
	DatabasesWithEmbeddings      int        `json:"databases_with_embeddings"`
	TablesWithEmbeddings         int        `json:"tables_with_embeddings"`
	TotalSchemaEmbeddings        int        `json:"total_schema_embeddings"`
	BusinessEntitiesCount        int        `json:"business_entities_count"`
	QueryTemplatesCount          int        `json:"query_templates_count"`
	LastSchemaEmbeddingGenerated *time.Time `json:"last_schema_embedding_generated"`
	LastEntityGenerated          *time.Time `json:"last_entity_generated"`
	LastTemplateGenerated        *time.Time `json:"last_template_generated"`
}

EmbeddingConfigStats holds statistics for embedding configurations (IAC Standard)

type EmbeddingGenerationJob

type EmbeddingGenerationJob struct {
	ID              int        `json:"id" gorm:"primaryKey"`
	UUID            string     `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID     *string    `json:"referenceid" gorm:"uniqueIndex"`
	ConfigID        int        `json:"config_id" gorm:"not null"`
	JobType         string     `json:"job_type" gorm:"not null"`
	DatabaseAlias   *string    `json:"database_alias"`
	Status          string     `json:"status" gorm:"default:pending"`
	TotalItems      int        `json:"total_items"`
	ProcessedItems  int        `json:"processed_items" gorm:"default:0"`
	FailedItems     int        `json:"failed_items" gorm:"default:0"`
	ErrorMessage    *string    `json:"error_message"`
	StartedAt       *time.Time `json:"started_at"`
	CompletedAt     *time.Time `json:"completed_at"`
	Active          bool       `json:"active" gorm:"default:true"`
	CreatedBy       string     `json:"createdby" gorm:"not null"`
	CreatedOn       time.Time  `json:"createdon" gorm:"default:CURRENT_TIMESTAMP"`
	ModifiedBy      *string    `json:"modifiedby"`
	ModifiedOn      *time.Time `json:"modifiedon"`
	RowVersionStamp int        `json:"rowversionstamp" gorm:"default:1"`
}

EmbeddingGenerationJob tracks batch embedding generation (IAC Standard)

func (EmbeddingGenerationJob) TableName

func (EmbeddingGenerationJob) TableName() string

TableName specifies the table name for GORM

type EmbeddingSearchLog

type EmbeddingSearchLog struct {
	ID               int             `json:"id" gorm:"primaryKey"`
	UUID             string          `json:"uuid" gorm:"type:uuid;default:gen_random_uuid();uniqueIndex"`
	ReferenceID      *string         `json:"referenceid" gorm:"uniqueIndex"`
	ConfigID         int             `json:"config_id" gorm:"not null"`
	SearchType       string          `json:"search_type" gorm:"not null"`
	SearchQuery      string          `json:"search_query" gorm:"not null"`
	SearchVector     Vector          `json:"search_vector,omitempty" gorm:"type:vector"`
	ResultsCount     int             `json:"results_count"`
	TopResults       json.RawMessage `json:"top_results" gorm:"type:jsonb"`
	SearchDurationMs int             `json:"search_duration_ms"`
	UserFeedback     *string         `json:"user_feedback"`
	Active           bool            `json:"active" gorm:"default:true"`
	CreatedBy        string          `json:"createdby" gorm:"not null"`
	CreatedOn        time.Time       `json:"createdon" gorm:"default:CURRENT_TIMESTAMP"`
	ModifiedBy       *string         `json:"modifiedby"`
	ModifiedOn       *time.Time      `json:"modifiedon"`
	RowVersionStamp  int             `json:"rowversionstamp" gorm:"default:1"`
}

EmbeddingSearchLog logs vector similarity searches (IAC Standard)

func (EmbeddingSearchLog) TableName

func (EmbeddingSearchLog) TableName() string

TableName specifies the table name for GORM

type EntityType

type EntityType string

EntityType represents the type of entity for embeddings

const (
	EntityTypeTable          EntityType = "table"
	EntityTypeColumn         EntityType = "column"
	EntityTypeBusinessEntity EntityType = "business_entity"
	EntityTypeQueryTemplate  EntityType = "query_template"
)

type GenerationType

type GenerationType string

GenerationType represents the type of AI generation

const (
	GenerationTypeSQL       GenerationType = "sql"
	GenerationTypeReport    GenerationType = "report"
	GenerationTypeNarrative GenerationType = "narrative"
	GenerationTypeChart     GenerationType = "chart"
)

type JSONField

type JSONField struct {
	Data interface{}
}

JSONField is a flexible type for JSON fields that can hold arrays or objects

func (JSONField) MarshalJSON

func (j JSONField) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler for JSONField

func (*JSONField) Scan

func (j *JSONField) Scan(value interface{}) error

Scan implements the sql.Scanner interface for JSONField

func (*JSONField) UnmarshalJSON

func (j *JSONField) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler for JSONField

func (JSONField) Value

func (j JSONField) Value() (driver.Value, error)

Value implements the driver.Valuer interface for JSONField

type JSONMap

type JSONMap map[string]interface{}

JSONMap is a helper type for JSON fields

func (*JSONMap) Scan

func (j *JSONMap) Scan(value interface{}) error

Scan implements the sql.Scanner interface

func (JSONMap) Value

func (j JSONMap) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type Job

type Job struct {
	ID              string      `json:"id" db:"id"`
	Name            string      `json:"name" db:"name"`                       // Job name
	Description     string      `json:"description" db:"description"`         // Job description
	TypeID          int         `json:"typeid" db:"typeid"`                   // Job type
	Handler         string      `json:"handler" db:"handler"`                 // Transaction code or command to execute
	CronExpression  string      `json:"cronexpression" db:"cronexpression"`   // Cron expression for scheduling
	IntervalSeconds int         `json:"intervalseconds" db:"intervalseconds"` // Interval in seconds (alternative to cron)
	StartAt         *time.Time  `json:"startat" db:"startat"`                 // When to start execution
	EndAt           *time.Time  `json:"endat" db:"endat"`                     // When to stop execution
	MaxExecutions   int         `json:"maxexecutions" db:"maxexecutions"`     // Maximum number of executions (0 = unlimited)
	ExecutionCount  int         `json:"executioncount" db:"executioncount"`   // Current execution count
	Enabled         bool        `json:"enabled" db:"enabled"`                 // Whether job is enabled
	Condition       string      `json:"condition" db:"condition"`             // SQL or expression to evaluate before execution
	Priority        int         `json:"priority" db:"priority"`               // Job priority
	MaxRetries      int         `json:"maxretries" db:"maxretries"`           // Maximum retry attempts for generated jobs
	Timeout         int         `json:"timeout" db:"timeout"`                 // Timeout in seconds
	Metadata        JobMetadata `json:"metadata" db:"metadata"`               // Additional configuration
	LastRunAt       *time.Time  `json:"lastRunAt" db:"lastRunAt"`             // Last execution time
	NextRunAt       *time.Time  `json:"nextRunAt" db:"nextRunAt"`             // Next scheduled execution time
	Active          bool        `json:"active" db:"active"`
	ReferenceID     string      `json:"referenceid" db:"referenceid"`
	CreatedBy       string      `json:"createdby" db:"createdby"`
	CreatedOn       time.Time   `json:"createdon" db:"createdon"`
	ModifiedBy      string      `json:"modifiedby" db:"modifiedby"`
	ModifiedOn      time.Time   `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp int         `json:"rowversionstamp" db:"rowversionstamp"`
}

Job represents a scheduled/interval job configuration

type JobDirection

type JobDirection string

JobDirection represents the direction of message flow

const (
	JobDirectionInbound  JobDirection = "inbound"
	JobDirectionOutbound JobDirection = "outbound"
	JobDirectionInternal JobDirection = "internal"
)

type JobHistory

type JobHistory struct {
	ID              string      `json:"id" db:"id"`
	JobID           string      `json:"jobid" db:"jobid"`               // Reference to QueueJob
	ExecutionID     string      `json:"executionid" db:"executionid"`   // Unique execution identifier
	StatusID        int         `json:"statusid" db:"statusid"`         // Execution status
	StartedAt       time.Time   `json:"startedat" db:"startedat"`       // Execution start time
	CompletedAt     *time.Time  `json:"completedat" db:"completedat"`   // Execution completion time
	Duration        int64       `json:"duration" db:"duration"`         // Duration in milliseconds
	Result          string      `json:"result" db:"result"`             // Execution result
	ErrorMessage    string      `json:"errormessage" db:"errormessage"` // Error details if failed
	RetryAttempt    int         `json:"retryattempt" db:"retryattempt"` // Which retry attempt this was
	ExecutedBy      string      `json:"executedby" db:"executedby"`     // Worker/instance that executed
	InputData       string      `json:"inputdata" db:"inputdata"`       // Input data snapshot
	OutputData      string      `json:"outputdata" db:"outputdata"`     // Output data
	Metadata        JobMetadata `json:"metadata" db:"metadata"`         // Execution metadata
	Active          bool        `json:"active" db:"active"`
	ReferenceID     string      `json:"referenceid" db:"referenceid"`
	CreatedBy       string      `json:"createdby" db:"createdby"`
	CreatedOn       time.Time   `json:"createdon" db:"createdon"`
	ModifiedBy      string      `json:"modifiedby" db:"modifiedby"`
	ModifiedOn      time.Time   `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp int         `json:"rowversionstamp" db:"rowversionstamp"`
}

JobHistory represents the execution history of jobs

type JobLock

type JobLock struct {
	JobID      string    `json:"jobid"`
	InstanceID string    `json:"instanceid"`
	LockedAt   time.Time `json:"lockedat"`
	ExpiresAt  time.Time `json:"expiresat"`
}

JobLock represents a distributed lock for job processing

type JobMetadata

type JobMetadata map[string]interface{}

JobMetadata stores flexible metadata for jobs

func (*JobMetadata) Scan

func (j *JobMetadata) Scan(value interface{}) error

Scan implements sql.Scanner interface

func (JobMetadata) Value

func (j JobMetadata) Value() (driver.Value, error)

Value implements driver.Valuer interface

type JobStatus

type JobStatus int

JobStatus represents the status of a job

const (
	JobStatusPending JobStatus = iota
	JobStatusQueued
	JobStatusProcessing
	JobStatusCompleted
	JobStatusFailed
	JobStatusRetrying
	JobStatusCancelled
	JobStatusScheduled
)

type JobType

type JobType int

JobType represents the type of job

const (
	JobTypeIntegration JobType = iota
	JobTypeScheduled
	JobTypeManual
	JobTypeSystem
)

type MessageType

type MessageType string

MessageType represents the type of chat message

const (
	MessageTypeUser      MessageType = "user"
	MessageTypeAssistant MessageType = "assistant"
)

type MetadataType

type MetadataType string

MetadataType represents the type of schema metadata

const (
	MetadataTypeTable  MetadataType = "table"
	MetadataTypeColumn MetadataType = "column"
)

type NullableTime

type NullableTime struct {
	sql.NullTime
}

NullableTime is a custom nullable time type that can handle both []uint8 and time.Time scanning

func (NullableTime) MarshalJSON

func (nt NullableTime) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*NullableTime) Scan

func (nt *NullableTime) Scan(value interface{}) error

Scan implements the sql.Scanner interface

func (*NullableTime) UnmarshalJSON

func (nt *NullableTime) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

func (NullableTime) Value

func (nt NullableTime) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type ParameterType

type ParameterType string

ParameterType represents the type of report parameter

const (
	ParameterTypeText        ParameterType = "text"
	ParameterTypeNumber      ParameterType = "number"
	ParameterTypeDate        ParameterType = "date"
	ParameterTypeDateTime    ParameterType = "datetime"
	ParameterTypeSelect      ParameterType = "select"
	ParameterTypeMultiSelect ParameterType = "multi_select"
	ParameterTypeBoolean     ParameterType = "boolean"
)

type QueryTemplate

type QueryTemplate struct {
	ID                    int          `json:"id" gorm:"column:id;primaryKey;autoIncrement"`
	UUID                  string       `json:"uuid" gorm:"column:uuid;type:uuid;not null;uniqueIndex"`
	ReferenceID           string       `json:"referenceid" gorm:"column:referenceid;type:varchar(255);uniqueIndex"`
	ConfigID              int          `json:"config_id" gorm:"column:config_id;not null"`
	TemplateName          string       `json:"template_name" gorm:"column:template_name;type:varchar(255);not null"`
	TemplateCategory      string       `json:"template_category" gorm:"column:template_category;type:varchar(100)"`
	NaturalLanguageQuery  string       `json:"natural_language_query" gorm:"column:natural_language_query;type:text;not null"`
	SQLTemplate           string       `json:"sql_template" gorm:"column:sql_template;type:text;not null"`
	Parameters            JSONMap      `json:"parameters" gorm:"column:parameters;type:jsonb"`
	DatabaseAlias         string       `json:"database_alias" gorm:"column:database_alias;type:varchar(255)"`
	EntitiesUsed          JSONMap      `json:"entities_used" gorm:"column:entities_used;type:jsonb"`
	ExampleQueries        JSONMap      `json:"example_queries" gorm:"column:example_queries;type:jsonb"`
	ExpectedResultsSchema JSONMap      `json:"expected_results_schema" gorm:"column:expected_results_schema;type:jsonb"`
	UsageCount            int          `json:"usage_count" gorm:"column:usage_count;default:0"`
	LastUsedAt            sql.NullTime `json:"last_used_at" gorm:"column:last_used_at"`
	Embedding             VectorArray  `json:"embedding,omitempty" gorm:"column:embedding;type:vector"`
	EmbeddingHash         string       `json:"embedding_hash" gorm:"column:embedding_hash;type:varchar(64)"`
	GeneratedAt           sql.NullTime `json:"generated_at" gorm:"column:generated_at;default:CURRENT_TIMESTAMP"`

	// Standard IAC audit fields
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(255);not null"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;default:CURRENT_TIMESTAMP"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(255)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

QueryTemplate represents reusable query patterns

func (QueryTemplate) TableName

func (QueryTemplate) TableName() string

TableName specifies the table name

type QueryTemplateRequest

type QueryTemplateRequest struct {
	ConfigID              int                    `json:"config_id" binding:"required"`
	TemplateName          string                 `json:"template_name" binding:"required" gorm:"column:template_name"`
	TemplateCategory      string                 `json:"template_category" gorm:"column:template_category"`
	NaturalLanguageQuery  string                 `json:"natural_language_query" binding:"required" gorm:"column:natural_language_query"`
	SQLTemplate           string                 `json:"sql_template" binding:"required"`
	Parameters            map[string]interface{} `json:"parameters"`
	DatabaseAlias         *string                `json:"database_alias"`
	EntitiesUsed          []string               `json:"entities_used"`
	ExampleQueries        []string               `json:"example_queries"`
	ExpectedResultsSchema map[string]interface{} `json:"expected_results_schema"`
}

QueryTemplateRequest represents request to create/update query template

type QueueJob

type QueueJob struct {
	ID              string       `json:"id" db:"id"`
	TypeID          int          `json:"typeid" db:"typeid"`
	Method          string       `json:"method" db:"method"`
	Protocol        string       `json:"protocol" db:"protocol"`
	Direction       JobDirection `json:"direction" db:"direction"`
	Handler         string       `json:"handler" db:"handler"`         // Transaction code or command to execute
	Metadata        JobMetadata  `json:"metadata" db:"metadata"`       // Flexible metadata storage
	Payload         string       `json:"payload" db:"payload"`         // Job payload/data
	Result          string       `json:"result" db:"result"`           // Execution result
	StatusID        int          `json:"statusid" db:"statusid"`       // Job status
	Priority        int          `json:"priority" db:"priority"`       // Higher number = higher priority
	MaxRetries      int          `json:"maxretries" db:"maxretries"`   // Maximum retry attempts
	RetryCount      int          `json:"retrycount" db:"retrycount"`   // Current retry count
	ScheduledAt     *time.Time   `json:"scheduledat" db:"scheduledat"` // When to execute (null = immediate)
	StartedAt       *time.Time   `json:"startedat" db:"startedat"`     // When execution started
	CompletedAt     *time.Time   `json:"completedat" db:"completedat"` // When execution completed
	LastError       string       `json:"lasterror" db:"lasterror"`     // Last error message
	ParentJobID     string       `json:"parentjobid" db:"parentjobid"` // Parent job for chained jobs
	Active          bool         `json:"active" db:"active"`
	ReferenceID     string       `json:"referenceid" db:"referenceid"`
	CreatedBy       string       `json:"createdby" db:"createdby"`
	CreatedOn       time.Time    `json:"createdon" db:"createdon"`
	ModifiedBy      string       `json:"modifiedby" db:"modifiedby"`
	ModifiedOn      time.Time    `json:"modifiedon" db:"modifiedon"`
	RowVersionStamp int          `json:"rowversionstamp" db:"rowversionstamp"`
}

QueueJob represents a job in the queue to be executed

type Report

type Report struct {
	ID               string     `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	Name             string     `json:"name" gorm:"column:name;type:varchar(255);not null"`
	Description      string     `json:"description" gorm:"column:description;type:text"`
	ReportType       ReportType `json:"reporttype" gorm:"column:reporttype;type:enum('manual','ai_generated','template');default:'manual'"`
	IsPublic         bool       `json:"ispublic" gorm:"column:ispublic;default:false"`
	IsTemplate       bool       `json:"istemplate" gorm:"column:istemplate;default:false"`
	LayoutConfig     JSONMap    `json:"layoutconfig" gorm:"column:layoutconfig;type:json"`
	PageSettings     JSONMap    `json:"pagesettings" gorm:"column:pagesettings;type:json"`
	AIPrompt         string     `json:"aiprompt" gorm:"column:aiprompt;type:text"`
	AIAnalysis       JSONMap    `json:"aianalysis" gorm:"column:aianalysis;type:json"`
	TemplateSourceID string     `json:"templatesourceid" gorm:"column:templatesourceid;type:varchar(36)"`
	Tags             JSONMap    `json:"tags" gorm:"column:tags;type:json"`
	Version          int        `json:"version" gorm:"column:version;default:1"`
	LastExecutedOn   *time.Time `json:"lastexecutedon" gorm:"column:lastexecutedon"`

	// Relationships
	Datasources []ReportDatasource `json:"datasources,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`
	Components  []ReportComponent  `json:"components,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`
	Parameters  []ReportParameter  `json:"parameters,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`
	Executions  []ReportExecution  `json:"executions,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`
	Shares      []ReportShare      `json:"shares,omitempty" gorm:"foreignKey:ReportID;constraint:OnDelete:CASCADE"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

Report represents a report definition

func (Report) TableName

func (Report) TableName() string

TableName specifies the table name

type ReportComponent

type ReportComponent struct {
	ID                    string        `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID              string        `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	ComponentType         ComponentType `` /* 176-byte string literal not displayed */
	Name                  string        `json:"name" gorm:"column:name;type:varchar(255);not null"`
	X                     float64       `json:"x" gorm:"column:x;type:decimal(10,2);default:0"`
	Y                     float64       `json:"y" gorm:"column:y;type:decimal(10,2);default:0"`
	Width                 float64       `json:"width" gorm:"column:width;type:decimal(10,2);default:200"`
	Height                float64       `json:"height" gorm:"column:height;type:decimal(10,2);default:100"`
	ZIndex                int           `json:"zindex" gorm:"column:zindex;default:0"`
	DatasourceAlias       string        `json:"datasourcealias" gorm:"column:datasourcealias;type:varchar(100)"`
	DataConfig            JSONField     `json:"dataconfig" gorm:"column:dataconfig;type:json"`
	ComponentConfig       JSONField     `json:"componentconfig" gorm:"column:componentconfig;type:json"`
	StyleConfig           JSONField     `json:"styleconfig" gorm:"column:styleconfig;type:json"`
	ChartType             *ChartType    `` /* 152-byte string literal not displayed */
	ChartConfig           JSONField     `json:"chartconfig" gorm:"column:chartconfig;type:json"`
	BarcodeType           *BarcodeType  `` /* 136-byte string literal not displayed */
	BarcodeConfig         JSONField     `json:"barcodeconfig" gorm:"column:barcodeconfig;type:json"`
	DrillDownConfig       JSONField     `json:"drilldownconfig" gorm:"column:drilldownconfig;type:json"`
	PageBreakConfig       JSONField     `json:"pagebreakconfig" gorm:"column:pagebreakconfig;type:json"`
	PageHeaderConfig      JSONField     `json:"pageheaderconfig" gorm:"column:pageheaderconfig;type:json"`
	PageFooterConfig      JSONField     `json:"pagefooterconfig" gorm:"column:pagefooterconfig;type:json"`
	ConditionalFormatting JSONField     `json:"conditionalformatting" gorm:"column:conditionalformatting;type:json"`
	IsVisible             bool          `json:"isvisible" gorm:"column:isvisible;default:true"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportComponent represents a visual component in a report

func (ReportComponent) TableName

func (ReportComponent) TableName() string

TableName specifies the table name

type ReportDatasource

type ReportDatasource struct {
	ID             string    `json:"id" gorm:"primaryKey;type:varchar(36);default:(UUID())"`
	ReportID       string    `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	Alias          string    `json:"alias" gorm:"column:alias;type:varchar(100);not null"`
	DatabaseAlias  string    `json:"databasealias" gorm:"column:databasealias;type:varchar(100)"`
	QueryType      string    `json:"querytype" gorm:"column:querytype;type:varchar(20);default:'visual'"`
	CustomSQL      string    `json:"customsql" gorm:"column:customsql;type:text"`
	SelectedTables JSONField `json:"selectedtables" gorm:"column:selectedtables;type:json"`
	SelectedFields JSONField `json:"selectedfields" gorm:"column:selectedfields;type:json"`
	Joins          JSONField `json:"joins" gorm:"column:joins;type:json"`
	Filters        JSONField `json:"filters" gorm:"column:filters;type:json"`
	Sorting        JSONField `json:"sorting" gorm:"column:sorting;type:json"`
	Grouping       JSONField `json:"grouping" gorm:"column:grouping;type:json"`
	Parameters     JSONField `json:"parameters" gorm:"column:parameters;type:json"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportDatasource represents a data source for a report

func (ReportDatasource) TableName

func (ReportDatasource) TableName() string

TableName specifies the table name

type ReportExecution

type ReportExecution struct {
	ID              string  `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID        string  `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	ExecutedBy      string  `json:"executedby" gorm:"column:executedby;type:varchar(36)"`
	ExecutionStatus string  `json:"executionstatus" gorm:"column:executionstatus;type:varchar(20);default:'pending'"`
	ExecutionTimeMs int     `json:"executiontimems" gorm:"column:executiontimems"`
	ErrorMessage    string  `json:"errormessage" gorm:"column:errormessage;type:text"`
	Parameters      JSONMap `json:"parameters" gorm:"column:parameters;type:json"`
	OutputFormat    string  `json:"outputformat" gorm:"column:outputformat;type:varchar(20)"`
	OutputSizeBytes int64   `json:"outputsizebytes" gorm:"column:outputsizebytes"`
	OutputPath      string  `json:"outputpath" gorm:"column:outputpath;type:varchar(500)"`
	RowCount        int     `json:"rowcount" gorm:"column:rowcount"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportExecution represents a report execution record

func (ReportExecution) TableName

func (ReportExecution) TableName() string

TableName specifies the table name

type ReportParameter

type ReportParameter struct {
	ID              string        `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID        string        `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	Name            string        `json:"name" gorm:"column:name;type:varchar(100);not null"`
	DisplayName     string        `json:"displayname" gorm:"column:displayname;type:varchar(100)"`
	ParameterType   ParameterType `` /* 142-byte string literal not displayed */
	DefaultValue    string        `json:"defaultvalue" gorm:"column:defaultvalue;type:text"`
	IsRequired      bool          `json:"isrequired" gorm:"column:isrequired;default:false"`
	IsEnabled       bool          `json:"isenabled" gorm:"column:isenabled;default:true"`
	ValidationRules string        `json:"validationrules" gorm:"column:validationrules;type:text"`
	Options         string        `json:"options" gorm:"column:options;type:text"`
	Description     string        `json:"description" gorm:"column:description;type:text"`
	SortOrder       int           `json:"sortorder" gorm:"column:sortorder;default:0"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportParameter represents an input parameter for a report

func (ReportParameter) TableName

func (ReportParameter) TableName() string

TableName specifies the table name

type ReportSchedule

type ReportSchedule struct {
	ID             string     `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID       string     `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	ScheduleName   string     `json:"schedulename" gorm:"column:schedulename;type:varchar(255)"`
	CronExpression string     `json:"cronexpression" gorm:"column:cronexpression;type:varchar(100);not null"`
	Timezone       string     `json:"timezone" gorm:"column:timezone;type:varchar(50);default:'UTC'"`
	OutputFormat   string     `json:"outputformat" gorm:"column:outputformat;type:varchar(20);default:'pdf'"`
	DeliveryMethod string     `json:"deliverymethod" gorm:"column:deliverymethod;type:varchar(20);default:'email'"`
	DeliveryConfig JSONMap    `json:"deliveryconfig" gorm:"column:deliveryconfig;type:json"`
	Parameters     JSONMap    `json:"parameters" gorm:"column:parameters;type:json"`
	LastRunAt      *time.Time `json:"lastrunat" gorm:"column:lastrunat"`
	NextRunAt      *time.Time `json:"nextrunat" gorm:"column:nextrunat"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportSchedule represents a scheduled report execution

func (ReportSchedule) TableName

func (ReportSchedule) TableName() string

TableName specifies the table name

type ReportShare

type ReportShare struct {
	ID         string     `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	ReportID   string     `json:"reportid" gorm:"column:reportid;type:varchar(36);not null"`
	SharedBy   string     `json:"sharedby" gorm:"column:sharedby;type:varchar(36)"`
	SharedWith string     `json:"sharedwith" gorm:"column:sharedwith;type:varchar(36)"`
	CanView    bool       `json:"canview" gorm:"column:canview;default:true"`
	CanEdit    bool       `json:"canedit" gorm:"column:canedit;default:false"`
	CanExecute bool       `json:"canexecute" gorm:"column:canexecute;default:true"`
	CanShare   bool       `json:"canshare" gorm:"column:canshare;default:false"`
	ShareToken string     `json:"sharetoken" gorm:"column:sharetoken;type:varchar(255);uniqueIndex"`
	ExpiresAt  *time.Time `json:"expiresat" gorm:"column:expiresat"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportShare represents report sharing permissions

func (ReportShare) TableName

func (ReportShare) TableName() string

TableName specifies the table name

type ReportTemplate

type ReportTemplate struct {
	ID                string  `json:"id" gorm:"primaryKey;column:id;type:varchar(36);default:(UUID())"`
	Name              string  `json:"name" gorm:"column:name;type:varchar(255);not null"`
	Description       string  `json:"description" gorm:"column:description;type:text"`
	Category          string  `json:"category" gorm:"column:category;type:varchar(100)"`
	TemplateConfig    JSONMap `json:"templateconfig" gorm:"column:templateconfig;type:json"`
	PreviewImage      string  `json:"previewimage" gorm:"column:previewimage;type:varchar(500)"`
	UsageCount        int     `json:"usagecount" gorm:"column:usagecount;default:0"`
	Rating            float64 `json:"rating" gorm:"column:rating;type:decimal(3,2);default:0.00"`
	AICompatible      bool    `json:"aicompatible" gorm:"column:aicompatible;default:false"`
	AITags            JSONMap `json:"aitags" gorm:"column:aitags;type:json"`
	SuggestedUseCases JSONMap `json:"suggestedusecases" gorm:"column:suggestedusecases;type:json"`
	IsPublic          bool    `json:"ispublic" gorm:"column:ispublic;default:true"`
	IsSystem          bool    `json:"issystem" gorm:"column:issystem;default:false"`

	// Standard IAC audit fields (must be at end)
	Active          bool   `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       Time   `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      Time   `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int    `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

ReportTemplate represents a pre-built report template

func (ReportTemplate) TableName

func (ReportTemplate) TableName() string

TableName specifies the table name

type ReportType

type ReportType string

ReportType represents the type of report

const (
	ReportTypeManual      ReportType = "manual"
	ReportTypeAIGenerated ReportType = "ai_generated"
	ReportTypeTemplate    ReportType = "template"
)

type SchemaEmbedding

type SchemaEmbedding struct {
	ID            string     `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	DatabaseAlias string     `json:"database_alias" gorm:"column:databasealias;type:varchar(100);not null"`
	EntityType    EntityType `json:"entity_type" gorm:"column:entitytype;type:enum('table','column','business_entity','query_template');not null"`
	EntityID      string     `json:"entity_id" gorm:"column:entityid;type:varchar(36);not null"`
	EntityText    string     `json:"entity_text" gorm:"column:entitytext;type:text;not null"`
	Embedding     JSONMap    `json:"embedding" gorm:"column:embedding;type:json;not null"`
	ModelName     string     `json:"model_name" gorm:"column:modelname;type:varchar(100);default:'text-embedding-ada-002'"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"reference_id" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"created_by" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"created_at" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modified_by" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"updated_at" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"row_version_stamp" gorm:"column:rowversionstamp;default:1"`
}

SchemaEmbedding represents vector embeddings for semantic search

func (SchemaEmbedding) TableName

func (SchemaEmbedding) TableName() string

TableName specifies the table name

type SchemaMetadataRequest

type SchemaMetadataRequest struct {
	ConfigID      int      `json:"config_id" binding:"required"`
	DatabaseAlias string   `json:"database_alias" binding:"required"`
	SchemaName    string   `json:"schema_name"`
	Tables        []string `json:"tables"` // Empty means all tables
}

SchemaMetadataRequest represents request to generate schema embeddings

type SearchRequest

type SearchRequest struct {
	ConfigID   int    `json:"config_id" binding:"required"`
	SearchType string `json:"search_type" binding:"required"` // 'schema', 'entity', 'query'
	Query      string `json:"query" binding:"required"`
	Limit      int    `json:"limit"` // Default 10
}

SearchRequest represents a vector similarity search request

type SearchResponse

type SearchResponse struct {
	Results      []SearchResult `json:"results"`
	TotalResults int            `json:"total_results"`
	SearchTime   int            `json:"search_time_ms"`
}

SearchResponse represents search results

type SearchResult

type SearchResult struct {
	ID          int                    `json:"id"`
	Score       float32                `json:"score"` // Similarity score
	Type        string                 `json:"type"`
	Name        string                 `json:"name"`
	Description string                 `json:"description"`
	Metadata    map[string]interface{} `json:"metadata"`
}

SearchResult represents a single search result

type SettingType

type SettingType string

SettingType represents the type of system setting

const (
	SettingTypeString  SettingType = "string"
	SettingTypeNumber  SettingType = "number"
	SettingTypeBoolean SettingType = "boolean"
	SettingTypeJSON    SettingType = "json"
)

type SystemSetting

type SystemSetting struct {
	ID           string      `json:"id" gorm:"column:id;primaryKey;type:varchar(36);default:(UUID())"`
	SettingKey   string      `json:"settingkey" gorm:"column:settingkey;type:varchar(100);not null;uniqueIndex"`
	SettingValue string      `json:"settingvalue" gorm:"column:settingvalue;type:text"`
	SettingType  SettingType `json:"settingtype" gorm:"column:settingtype;type:enum('string','number','boolean','json');default:'string'"`
	Description  string      `json:"description" gorm:"column:description;type:text"`
	IsEncrypted  bool        `json:"isencrypted" gorm:"column:isencrypted;default:false"`

	// Standard IAC audit fields (must be at end)
	Active          bool         `json:"active" gorm:"column:active;default:true"`
	ReferenceID     string       `json:"referenceid" gorm:"column:referenceid;type:varchar(36)"`
	CreatedBy       string       `json:"createdby" gorm:"column:createdby;type:varchar(45)"`
	CreatedOn       sql.NullTime `json:"createdon" gorm:"column:createdon;autoCreateTime"`
	ModifiedBy      string       `json:"modifiedby" gorm:"column:modifiedby;type:varchar(45)"`
	ModifiedOn      sql.NullTime `json:"modifiedon" gorm:"column:modifiedon;autoUpdateTime"`
	RowVersionStamp int          `json:"rowversionstamp" gorm:"column:rowversionstamp;default:1"`
}

SystemSetting represents system-wide settings

func (SystemSetting) TableName

func (SystemSetting) TableName() string

TableName specifies the table name

type Time

type Time struct {
	time.Time
}

Time is a custom time type that can handle both []uint8 and time.Time scanning

func (Time) MarshalJSON

func (t Time) MarshalJSON() ([]byte, error)

MarshalJSON implements json.Marshaler

func (*Time) Scan

func (t *Time) Scan(value interface{}) error

Scan implements the sql.Scanner interface

func (*Time) UnmarshalJSON

func (t *Time) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler

func (Time) Value

func (t Time) Value() (driver.Value, error)

Value implements the driver.Valuer interface

type Vector

type Vector = pgvector.Vector

Vector represents a pgvector embedding using the official pgvector-go library This type alias allows seamless integration with PostgreSQL's pgvector extension

type VectorArray

type VectorArray []float64

VectorArray is a helper type for vector operations

func (*VectorArray) Scan

func (v *VectorArray) Scan(value interface{}) error

Scan implements the sql.Scanner interface for vector arrays

func (VectorArray) Value

func (v VectorArray) Value() (driver.Value, error)

Value implements the driver.Valuer interface for vector arrays

Jump to

Keyboard shortcuts

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