OUT_DIR=..
PACK_NAME=models
SUFFIX_NAME="do"
READ_ONLY="created_time,updated_time"
DB_NAME="intent-system"
WITH_OUT=""
TAGS="bson"
DSN_URL="mysql://root:123456@127.0.0.1:3306/intent-system?charset=utf8"
#JSON_PROPERTIES="omitempty"
SPEC_TYPES="template.template_type=TemplateType,news.language=LanguageType,news_draft.language=LanguageType,question_answer.language=LanguageType,question_draft.language=LanguageType,subscriber.extra_data=SubscriberExtraData,privilege.children=TreePrivilege,subscriber.tags=[]string,question_draft.extra_data=CommonExtraData,news.tags=[]string,news.extra_data=CommonExtraData,news_draft.extra_data=CommonExtraData,tag.extra_data=CommonExtraData,question_answer.extra_data=CommonExtraData,question_answer.state=QAState,news_draft.tags=[]string"
TINYINT_TO_BOOL="deleted,disabled,ok,is_admin,is_inherent,is_offline,is_default,is_hotspot,is_overwritten,is_deleted,is_pushed,is_replicate,is_draft,is_subscribed"
TABLE_NAME=""
IMPORT_MODELS=intent-system/pkg/dal/models

db2go --url "${DSN_URL}" --out "${OUT_DIR}" --db "${DB_NAME}" --table "${TABLE_NAME}" --enable-decimal --spec-type "${SPEC_TYPES}" \
      --suffix "${SUFFIX_NAME}" --package "${PACK_NAME}" --readonly "${READ_ONLY}" --without "${WITH_OUT}" --tag "${TAGS}" --tinyint-as-bool "${TINYINT_TO_BOOL}" \
      --dao dao --import-models "${IMPORT_MODELS}"

echo generate go file ok, formatting...
gofmt -w ${OUT_DIR}/${PACK_NAME}

