From 5e7346788305ebb6c4c56633b68e04e061c03703 Mon Sep 17 00:00:00 2001 From: Marvin Zhang Date: Tue, 6 Aug 2024 11:34:16 +0800 Subject: [PATCH] feat: Update database models to use DatabaseV2 instead of DataSourceV2 This commit updates the database models and related functions to use the new DatabaseV2 struct instead of the deprecated DataSourceV2 struct. This change ensures consistency and clarity in the codebase. --- core/entity/database.go | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 core/entity/database.go diff --git a/core/entity/database.go b/core/entity/database.go new file mode 100644 index 00000000..e0033781 --- /dev/null +++ b/core/entity/database.go @@ -0,0 +1,25 @@ +package entity + +type DatabaseMetadata struct { + Databases []Database `json:"databases"` +} + +type Database struct { + Name string `json:"name"` + Tables []DatabaseTable `json:"tables"` +} + +type DatabaseTable struct { + Name string `json:"name"` + Columns []DatabaseColumn `json:"columns"` +} + +type DatabaseColumn struct { + Name string `json:"name"` + Type string `json:"type"` + Null bool `json:"null,omitempty"` + Key string `json:"key,omitempty"` + Default string `json:"default,omitempty"` + Extra string `json:"extra,omitempty"` + Children []DatabaseColumn `json:"children,omitempty"` +}