2020-11-18 15:32:53 +08:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
# generate model with cache from ddl
|
2020-12-21 09:43:32 +08:00
|
|
|
fromDDLWithCache:
|
2021-01-08 12:01:21 +08:00
|
|
|
goctl template clean
|
|
|
|
goctl model mysql ddl -src="./sql/*.sql" -dir="./sql/model/cache" -cache
|
2020-12-21 09:43:32 +08:00
|
|
|
|
2022-09-19 11:49:39 +08:00
|
|
|
fromDDLWithCacheAndIgnoreColumns:
|
|
|
|
goctl template clean
|
|
|
|
goctl model mysql ddl -src="./sql/*.sql" -dir="./sql/model/ignore_columns/cache" -cache -i 'gmt_create,create_at' -i 'gmt_modified,update_at'
|
|
|
|
|
2021-08-18 17:09:34 +08:00
|
|
|
fromDDLWithCacheAndDb:
|
|
|
|
goctl template clean
|
|
|
|
goctl model mysql ddl -src="./sql/*.sql" -dir="./sql/model/cache_db" -database="1gozero" -cache
|
|
|
|
|
2020-12-21 09:43:32 +08:00
|
|
|
fromDDLWithoutCache:
|
|
|
|
goctl template clean;
|
2021-01-08 12:01:21 +08:00
|
|
|
goctl model mysql ddl -src="./sql/*.sql" -dir="./sql/model/nocache"
|
2020-11-18 15:32:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
# generate model with cache from data source
|
2021-03-01 21:14:07 +08:00
|
|
|
user=root
|
|
|
|
password=password
|
2020-11-18 15:32:53 +08:00
|
|
|
datasource=127.0.0.1:3306
|
|
|
|
database=gozero
|
|
|
|
|
|
|
|
fromDataSource:
|
2021-01-08 12:01:21 +08:00
|
|
|
goctl template clean
|
|
|
|
goctl model mysql datasource -url="$(user):$(password)@tcp($(datasource))/$(database)" -table="*" -dir ./model/cache -c -style gozero
|