yjp 1 рік тому
батько
коміт
b48611b16f

+ 9 - 0
examples/examples/project/deployment/data_service/apply_data_containers.ps1

@@ -0,0 +1,9 @@
+Set-Location  $(Split-Path $MyInvocation.MyCommand.Path -Parent)
+
+datactl.exe apply -f base.yaml
+
+foreach ($file in $(Get-ChildItem -Path ".\data_containers")) {
+    if ($file.GetType() -eq [System.IO.FileInfo]) {
+        datactl.exe apply -f $file.FullName
+    }
+}

+ 10 - 0
examples/examples/project/deployment/data_service/apply_data_containers.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+cd "$(dirname "$0")" || exit 1
+
+datactl apply -f base.yaml
+
+for file in ./data_containers/*; do
+	if [ -f "$file" ]; then
+		datactl apply -f "$file"
+	fi
+done

+ 27 - 0
examples/examples/project/deployment/data_service/base.yaml

@@ -0,0 +1,27 @@
+kind: Namespace
+spec:
+  name: baize
+
+---
+
+kind: DataSource
+spec:
+  type: database
+  namespace: baize
+  name: baize
+  spec:
+    type: postgres
+    user_name: test
+    password: "123456"
+    address: "10.0.0.84"
+    port: "30432"
+    database: test
+    max_connections: 40
+    max_idle_connections: 10
+
+
+---
+
+
+
+---

+ 30 - 0
examples/examples/project/deployment/data_service/data_containers/class.yaml

@@ -0,0 +1,30 @@
+kind: DataContainer
+spec:
+  namespace: baize
+  data_source: baize
+  name: test.classes
+  spec:
+    table_name: test.classes
+    columns:
+      - name: id
+        type: varchar(32)
+        comment: id
+        primary_key: true
+      - name: name
+        type: varchar(128)
+        comment: 班名
+        not_null: true
+        index: true
+      - name: student_num
+        type: integer
+        comment: 学生数量
+        not_null: true
+        index: true
+      - name: created_time
+        type: "timestamp with time zone"
+        comment: 创建时间
+        not_null: true
+      - name: last_updated_time
+        type: "timestamp with time zone"
+        comment: 最近更新时间
+        not_null: true

+ 23 - 0
examples/examples/project/deployment/data_service/data_containers/configuration.yaml

@@ -0,0 +1,23 @@
+kind: DataContainer
+spec:
+  namespace: baize
+  data_source: baize
+  name: test.configurations
+  spec:
+    table_name: test.configurations
+    columns:
+      - name: scope
+        type: varchar(256)
+        comment: 范围
+        not_null: true
+        primary_key: true
+      - name: group
+        type: varchar(256)
+        comment: 组
+        not_null: true
+        primary_key: true
+      - name: value
+        type: varchar(256)
+        comment: 值
+        not_null: true
+        index: true

+ 35 - 0
examples/examples/project/deployment/data_service/data_containers/family.yaml

@@ -0,0 +1,35 @@
+kind: DataContainer
+spec:
+  namespace: baize
+  data_source: baize
+  name: test.families
+  spec:
+    table_name: test.families
+    columns:
+      - name: id
+        type: varchar(32)
+        comment: id
+        primary_key: true
+      - name: father
+        type: varchar(128)
+        comment: 父亲姓名
+        not_null: true
+        index: true
+      - name: mother
+        type: varchar(128)
+        comment: 母亲姓名
+        not_null: true
+        index: true
+      - name: student_id
+        type: varchar(32)
+        comment: 家庭ID
+        not_null: true
+        index: true
+      - name: created_time
+        type: "timestamp with time zone"
+        comment: 创建时间
+        not_null: true
+      - name: last_updated_time
+        type: "timestamp with time zone"
+        comment: 最近更新时间
+        not_null: true

+ 25 - 0
examples/examples/project/deployment/data_service/data_containers/identity.yaml

@@ -0,0 +1,25 @@
+kind: DataContainer
+spec:
+  namespace: baize
+  data_source: baize
+  name: test.identities
+  spec:
+    table_name: test.identities
+    columns:
+      - name: id
+        type: varchar(32)
+        comment: id
+        primary_key: true
+      - name: name
+        type: varchar(128)
+        comment: 名称
+        not_null: true
+        index: true
+      - name: created_time
+        type: "timestamp with time zone"
+        comment: 创建时间
+        not_null: true
+      - name: last_updated_time
+        type: "timestamp with time zone"
+        comment: 最近更新时间
+        not_null: true

+ 31 - 0
examples/examples/project/deployment/data_service/data_containers/student.yaml

@@ -0,0 +1,31 @@
+
+kind: DataContainer
+spec:
+  namespace: baize
+  data_source: baize
+  name: test.students
+  spec:
+    table_name: test.students
+    columns:
+      - name: id
+        type: varchar(32)
+        comment: id
+        primary_key: true
+      - name: name
+        type: varchar(128)
+        comment: 姓名
+        not_null: true
+        index: true
+      - name: family_id
+        type: varchar(32)
+        comment: 家庭ID
+        not_null: true
+        index: true
+      - name: created_time
+        type: "timestamp with time zone"
+        comment: 创建时间
+        not_null: true
+      - name: last_updated_time
+        type: "timestamp with time zone"
+        comment: 最近更新时间
+        not_null: true

+ 17 - 0
examples/examples/project/deployment/data_service/data_containers/student_and_identity.yaml

@@ -0,0 +1,17 @@
+
+kind: DataContainer
+spec:
+  namespace: baize
+  data_source: baize
+  name: test.student_and_identity
+  spec:
+    table_name: test.student_and_identity
+    columns:
+      - name: student_id
+        type: varchar(32)
+        comment: id
+        primary_key: true
+      - name: identity_id
+        type: varchar(32)
+        comment: id
+        primary_key: true

+ 9 - 0
examples/examples/project/deployment/data_service/delete_data_containers.ps1

@@ -0,0 +1,9 @@
+Set-Location  $(Split-Path $MyInvocation.MyCommand.Path -Parent)
+
+datactl.exe delete -f base.yaml
+
+foreach ($file in $(Get-ChildItem -Path ".\data_containers")) {
+    if ($file.GetType() -eq [System.IO.FileInfo]) {
+        datactl.exe apply -f $file.FullName
+    }
+}

+ 10 - 0
examples/examples/project/deployment/data_service/delete_data_containers.sh

@@ -0,0 +1,10 @@
+#!/bin/bash
+cd "$(dirname "$0")" || exit 1
+
+datactl delete -f base.yaml
+
+for file in ./data_containers/*; do
+	if [ -f "$file" ]; then
+		datactl apply -f "$file"
+	fi
+done

+ 0 - 197
examples/examples/project/deployment/resources/resources.yaml

@@ -1,197 +0,0 @@
-kind: Namespace
-spec:
-  name: baize
-
----
-
-kind: DataSource
-spec:
-  type: database
-  namespace: baize
-  name: baize
-  spec:
-    type: postgres
-    user_name: test
-    password: "123456"
-    address: "10.0.0.84"
-    port: "30432"
-    database: test
-    max_connections: 40
-    max_idle_connections: 10
-
----
-
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.classes
-  spec:
-    table_name: test.classes
-    columns:
-      - name: id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: name
-        type: varchar(128)
-        comment: 班名
-        not_null: true
-        index: true
-      - name: student_num
-        type: integer
-        comment: 学生数量
-        not_null: true
-        index: true
-      - name: created_time
-        type: "timestamp with time zone"
-        comment: 创建时间
-        not_null: true
-      - name: last_updated_time
-        type: "timestamp with time zone"
-        comment: 最近更新时间
-        not_null: true
-
----
-
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.students
-  spec:
-    table_name: test.students
-    columns:
-      - name: id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: name
-        type: varchar(128)
-        comment: 姓名
-        not_null: true
-        index: true
-      - name: family_id
-        type: varchar(32)
-        comment: 家庭ID
-        not_null: true
-        index: true
-      - name: created_time
-        type: "timestamp with time zone"
-        comment: 创建时间
-        not_null: true
-      - name: last_updated_time
-        type: "timestamp with time zone"
-        comment: 最近更新时间
-        not_null: true
-
----
-
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.families
-  spec:
-    table_name: test.families
-    columns:
-      - name: id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: father
-        type: varchar(128)
-        comment: 父亲姓名
-        not_null: true
-        index: true
-      - name: mother
-        type: varchar(128)
-        comment: 母亲姓名
-        not_null: true
-        index: true
-      - name: student_id
-        type: varchar(32)
-        comment: 家庭ID
-        not_null: true
-        index: true
-      - name: created_time
-        type: "timestamp with time zone"
-        comment: 创建时间
-        not_null: true
-      - name: last_updated_time
-        type: "timestamp with time zone"
-        comment: 最近更新时间
-        not_null: true
-
----
-
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.identities
-  spec:
-    table_name: test.identities
-    columns:
-      - name: id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: name
-        type: varchar(128)
-        comment: 名称
-        not_null: true
-        index: true
-      - name: created_time
-        type: "timestamp with time zone"
-        comment: 创建时间
-        not_null: true
-      - name: last_updated_time
-        type: "timestamp with time zone"
-        comment: 最近更新时间
-        not_null: true
-
----
-
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.configurations
-  spec:
-    table_name: test.configurations
-    columns:
-      - name: scope
-        type: varchar(256)
-        comment: 范围
-        not_null: true
-        primary_key: true
-      - name: group
-        type: varchar(256)
-        comment: 组
-        not_null: true
-        primary_key: true
-      - name: value
-        type: varchar(256)
-        comment: 值
-        not_null: true
-        index: true
-
----
-
-kind: DataContainer
-spec:
-  namespace: baize
-  data_source: baize
-  name: test.student_and_identity
-  spec:
-    table_name: test.student_and_identity
-    columns:
-      - name: student_id
-        type: varchar(32)
-        comment: id
-        primary_key: true
-      - name: identity_id
-        type: varchar(32)
-        comment: id
-        primary_key: true