From eee44472323c6c13c9d986e5bc86e4d982bacb6d Mon Sep 17 00:00:00 2001 From: Michael Li Date: Sat, 8 Jun 2024 17:54:12 +0800 Subject: [PATCH] mir: add service package to help start a service. add sail example for explain how to use mir. --- examples/README.md | 12 ++-- .../mir-example}/.gitignore | 2 +- examples/{ => mir-example}/Makefile | 0 examples/mir-example/README.md | 8 +++ examples/{ => mir-example}/go.mod | 4 +- examples/{ => mir-example}/go.sum | 0 examples/{ => mir-example}/main.go | 2 +- .../{ => mir-example}/mirc/auto/api/site.go | 0 .../mirc/auto/api/v1/admin.go | 0 .../mirc/auto/api/v1/site.go | 0 .../mir-example/mirc}/auto/api/v2/site.go | 4 +- .../mirc/auto/api/v3/site.go | 2 +- examples/{ => mir-example}/mirc/gen.go | 8 +-- .../{ => mir-example}/mirc/routes/site.go | 0 .../{ => mir-example}/mirc/routes/v1/site.go | 0 .../{ => mir-example}/mirc/routes/v2/site.go | 0 .../{ => mir-example}/mirc/routes/v3/site.go | 2 +- examples/{ => mir-example}/model/model.go | 0 .../{ => mir-example}/servants/admin_a.go | 2 +- examples/{ => mir-example}/servants/core.go | 0 .../{ => mir-example}/servants/servants.go | 8 +-- examples/{ => mir-example}/servants/site.go | 2 +- examples/{ => mir-example}/servants/site_a.go | 2 +- examples/{ => mir-example}/servants/site_b.go | 2 +- examples/{ => mir-example}/servants/site_c.go | 2 +- examples/{ => sail-example}/.gitignore | 4 +- .../sail-example}/Dockerfile | 0 .../sail-example}/Makefile | 4 +- .../sail-example}/README.md | 0 .../sail-example}/auto/api/bot/v1/user.go | 0 .../sail-example}/auto/api/site.go | 0 .../sail-example}/auto/api/v1/admin.go | 0 .../sail-example}/auto/api/v1/site.go | 0 .../auto/api/v2/site.go | 2 +- .../sail-example}/auto/api/v3/site.go | 2 +- .../sail-example}/cmd/migrate/migrate.go | 2 +- .../sail-example}/cmd/root.go | 0 .../sail-example}/cmd/serve/serve.go | 6 +- .../sail-example}/cmd/version.go | 2 +- .../sail-example}/config.yaml | 0 .../sail-example}/docs/README.md | 0 .../docs/openapi/assets/rapidoc-min.js | 0 .../sail-example}/docs/openapi/embed.go | 0 .../sail-example}/docs/openapi/index.html | 0 .../sail-example}/docs/openapi/openapi.json | 0 .../examples => examples/sail-example}/go.mod | 41 ++++++------- .../examples => examples/sail-example}/go.sum | 0 .../sail-example}/internal/conf/conf.go | 1 + .../sail-example}/internal/conf/config.yaml | 0 examples/sail-example/internal/conf/mir.go | 10 ++++ .../sail-example}/internal/conf/setting.go | 0 .../sail-example}/internal/conf/version.go | 0 .../sail-example}/internal/core/core.go | 0 .../sail-example}/internal/dao/dao.go | 0 .../sail-example}/internal/internal.go | 0 .../sail-example}/internal/model/model.go | 0 .../internal/servants/base/base.go | 0 .../internal/servants/bot/bot.go | 2 +- .../internal/servants/bot/user.go | 4 +- .../internal/servants/docs/docs.go | 0 .../internal/servants/docs/docs_embed.go | 2 +- .../internal/servants/servants.go | 6 +- .../internal/servants/web/admin_a.go | 4 +- .../internal/servants/web/site.go | 4 +- .../internal/servants/web/site_a.go | 4 +- .../internal/servants/web/site_b.go | 4 +- .../internal/servants/web/site_c.go | 4 +- .../internal/servants/web/web.go | 8 +-- .../sail-example}/internal/service/bot.go | 4 +- .../sail-example}/internal/service/docs.go | 4 +- .../sail-example}/internal/service/service.go | 4 +- .../sail-example}/internal/service/web.go | 4 +- .../sail-example}/main.go | 6 +- .../sail-example}/mirc/bot/README.md | 0 .../sail-example}/mirc/bot/v1/user.go | 0 .../sail-example}/mirc/gen.go | 10 ++-- .../sail-example}/mirc/web/site.go | 0 .../sail-example}/mirc/web/v1/site.go | 0 .../sail-example}/mirc/web/v2/site.go | 0 .../sail-example}/mirc/web/v3/site.go | 2 +- .../sail-example}/pkg/debug/annotation.go | 0 .../sail-example}/pkg/debug/errors.go | 0 .../sail-example}/pkg/types/types.go | 0 .../sail-example}/pkg/utils/str.go | 0 .../sail-example}/pkg/utils/str_test.go | 0 .../sail-example}/pkg/utils/utils.go | 0 .../sail-example}/pkg/xerror/common.go | 0 .../sail-example}/pkg/xerror/xerror.go | 0 .../sail-example}/scripts/README | 0 .../scripts/docker/Dockerfile.backend-builder | 0 .../scripts/docker/Dockerfile.backend-runner | 0 .../sail-example}/scripts/docker/README.md | 0 .../sail-example}/scripts/examples-mysql.sql | 0 .../scripts/examples-postgres.sql | 0 .../scripts/examples-sqlite3.sql | 0 .../sail-example}/scripts/migration/embed.go | 0 .../mysql/0001_initialize_schema.down.sql | 0 .../mysql/0001_initialize_schema.up.sql | 0 .../mysql/0002_post_visibility.down.sql | 0 .../mysql/0002_post_visibility.up.sql | 0 .../mysql/0003_feature_contact.down.sql | 0 .../mysql/0003_feature_contact.up.sql | 0 .../mysql/0004_optimize_idx.down.sql | 0 .../migration/mysql/0004_optimize_idx.up.sql | 0 .../migration/mysql/0005_share_count.down.sql | 0 .../migration/mysql/0005_share_count.up.sql | 0 .../mysql/0006_topic_follow.down.sql | 0 .../migration/mysql/0006_topic_follow.up.sql | 0 .../mysql/0007_comment_thumbs.down.sql | 0 .../mysql/0007_comment_thumbs.up.sql | 0 .../mysql/0008_content_type_alter.down.sql | 0 .../mysql/0008_content_type_alter.up.sql | 0 .../0009_create_view_post_filter.down.sql | 0 .../mysql/0009_create_view_post_filter.up.sql | 0 .../mysql/0010_user_following.down.sql | 0 .../mysql/0010_user_following.up.sql | 0 .../mysql/0011_home_timeline.down.sql | 0 .../migration/mysql/0011_home_timeline.up.sql | 0 .../mysql/0012_comment_essence.down.sql | 0 .../mysql/0012_comment_essence.up.sql | 0 .../mysql/0013_rank_metrics.down.sql | 0 .../migration/mysql/0013_rank_metrics.up.sql | 0 .../mysql/0014_user_relation_view.down.sql | 0 .../mysql/0014_user_relation_view.up.sql | 0 .../mysql/0015_topic_user_pin.down.sql | 0 .../mysql/0015_topic_user_pin.up.sql | 0 .../postgres/0001_initialize_schema.down.sql | 0 .../postgres/0001_initialize_schema.up.sql | 0 .../postgres/0002_post_visibility.down.sql | 0 .../postgres/0002_post_visibility.up.sql | 0 .../postgres/0003_feature_contact.down.sql | 0 .../postgres/0003_feature_contact.up.sql | 0 .../postgres/0004_share_count.down.sql | 0 .../postgres/0004_share_count.up.sql | 0 .../postgres/0005_topic_follow.down.sql | 0 .../postgres/0005_topic_follow.up.sql | 0 .../postgres/0006_comment_thumbs.down.sql | 0 .../postgres/0006_comment_thumbs.up.sql | 0 .../postgres/0007_content_type_alter.down.sql | 0 .../postgres/0007_content_type_alter.up.sql | 0 .../0008_create_view_post_filter.down.sql | 0 .../0008_create_view_post_filter.up.sql | 0 .../postgres/0009_user_following.down.sql | 0 .../postgres/0009_user_following.up.sql | 0 .../postgres/0010_home_timeline.down.sql | 0 .../postgres/0010_home_timeline.up.sql | 0 .../postgres/0011_comment_essence.down.sql | 0 .../postgres/0011_comment_essence.up.sql | 0 .../postgres/0012_rank_metrics.down.sql | 0 .../postgres/0012_rank_metrics.up.sql | 0 .../postgres/0013_user_relation_view.down.sql | 0 .../postgres/0013_user_relation_view.up.sql | 0 .../postgres/0014_topic_user_pin.down.sql | 0 .../postgres/0014_topic_user_pin.up.sql | 0 .../sqlite3/0001_initialize_schema.down.sql | 0 .../sqlite3/0001_initialize_schema.up.sql | 0 .../sqlite3/0002_post_visibility.down.sql | 0 .../sqlite3/0002_post_visibility.up.sql | 0 .../sqlite3/0003_feature_contact.down.sql | 0 .../sqlite3/0003_feature_contact.up.sql | 0 .../sqlite3/0004_optimize_idx.down.sql | 0 .../sqlite3/0004_optimize_idx.up.sql | 0 .../sqlite3/0005_share_count.down.sql | 0 .../migration/sqlite3/0005_share_count.up.sql | 0 .../sqlite3/0006_topic_follow.down.sql | 0 .../sqlite3/0006_topic_follow.up.sql | 0 .../sqlite3/0007_comment_thumbs.down.sql | 0 .../sqlite3/0007_comment_thumbs.up.sql | 0 .../sqlite3/0008_content_type_alter.down.sql | 0 .../sqlite3/0008_content_type_alter.up.sql | 0 .../0009_create_view_post_filter.down.sql | 0 .../0009_create_view_post_filter.up.sql | 0 .../sqlite3/0010_user_following.down.sql | 0 .../sqlite3/0010_user_following.up.sql | 0 .../sqlite3/0011_home_timeline.down.sql | 0 .../sqlite3/0011_home_timeline.up.sql | 0 .../sqlite3/0012_comment_essence.down.sql | 0 .../sqlite3/0012_comment_essence.up.sql | 0 .../sqlite3/0013_rank_metrics.down.sql | 0 .../sqlite3/0013_rank_metrics.up.sql | 0 .../sqlite3/0014_user_relation_view.down.sql | 0 .../sqlite3/0014_user_relation_view.up.sql | 0 .../sqlite3/0015_topic_user_pin.down.sql | 0 .../sqlite3/0015_topic_user_pin.up.sql | 0 sail/README.md | 3 - sail/go.mod | 25 -------- sail/go.sum | 57 ------------------- sail/json/go_json.go | 23 -------- sail/json/json.go | 25 -------- sail/json/jsoniter.go | 24 -------- sail/json/sonic.go | 27 --------- service/help.go | 17 ++++++ {sail/service => service}/http_server.go | 0 {sail/service => service}/http_service.go | 0 {sail/service => service}/runtime.go | 7 ++- {sail/service => service}/server.go | 28 ++++----- {sail/service => service}/service.go | 0 197 files changed, 147 insertions(+), 301 deletions(-) rename {sail/examples => examples/mir-example}/.gitignore (95%) rename examples/{ => mir-example}/Makefile (100%) create mode 100644 examples/mir-example/README.md rename examples/{ => mir-example}/go.mod (94%) rename examples/{ => mir-example}/go.sum (100%) rename examples/{ => mir-example}/main.go (89%) rename examples/{ => mir-example}/mirc/auto/api/site.go (100%) rename examples/{ => mir-example}/mirc/auto/api/v1/admin.go (100%) rename examples/{ => mir-example}/mirc/auto/api/v1/site.go (100%) rename {sail/examples => examples/mir-example/mirc}/auto/api/v2/site.go (100%) rename examples/{ => mir-example}/mirc/auto/api/v3/site.go (99%) rename examples/{ => mir-example}/mirc/gen.go (75%) rename examples/{ => mir-example}/mirc/routes/site.go (100%) rename examples/{ => mir-example}/mirc/routes/v1/site.go (100%) rename examples/{ => mir-example}/mirc/routes/v2/site.go (100%) rename examples/{ => mir-example}/mirc/routes/v3/site.go (97%) rename examples/{ => mir-example}/model/model.go (100%) rename examples/{ => mir-example}/servants/admin_a.go (84%) rename examples/{ => mir-example}/servants/core.go (100%) rename examples/{ => mir-example}/servants/servants.go (70%) rename examples/{ => mir-example}/servants/site.go (85%) rename examples/{ => mir-example}/servants/site_a.go (88%) rename examples/{ => mir-example}/servants/site_b.go (84%) rename examples/{ => mir-example}/servants/site_c.go (84%) rename examples/{ => sail-example}/.gitignore (89%) rename {sail/examples => examples/sail-example}/Dockerfile (100%) rename {sail/examples => examples/sail-example}/Makefile (86%) rename {sail/examples => examples/sail-example}/README.md (100%) rename {sail/examples => examples/sail-example}/auto/api/bot/v1/user.go (100%) rename {sail/examples => examples/sail-example}/auto/api/site.go (100%) rename {sail/examples => examples/sail-example}/auto/api/v1/admin.go (100%) rename {sail/examples => examples/sail-example}/auto/api/v1/site.go (100%) rename examples/{mirc => sail-example}/auto/api/v2/site.go (100%) rename {sail/examples => examples/sail-example}/auto/api/v3/site.go (99%) rename {sail/examples => examples/sail-example}/cmd/migrate/migrate.go (93%) rename {sail/examples => examples/sail-example}/cmd/root.go (100%) rename {sail/examples => examples/sail-example}/cmd/serve/serve.go (90%) rename {sail/examples => examples/sail-example}/cmd/version.go (90%) rename {sail/examples => examples/sail-example}/config.yaml (100%) rename {sail/examples => examples/sail-example}/docs/README.md (100%) rename {sail/examples => examples/sail-example}/docs/openapi/assets/rapidoc-min.js (100%) rename {sail/examples => examples/sail-example}/docs/openapi/embed.go (100%) rename {sail/examples => examples/sail-example}/docs/openapi/index.html (100%) rename {sail/examples => examples/sail-example}/docs/openapi/openapi.json (100%) rename {sail/examples => examples/sail-example}/go.mod (92%) rename {sail/examples => examples/sail-example}/go.sum (100%) rename {sail/examples => examples/sail-example}/internal/conf/conf.go (98%) rename {sail/examples => examples/sail-example}/internal/conf/config.yaml (100%) create mode 100644 examples/sail-example/internal/conf/mir.go rename {sail/examples => examples/sail-example}/internal/conf/setting.go (100%) rename {sail/examples => examples/sail-example}/internal/conf/version.go (100%) rename {sail/examples => examples/sail-example}/internal/core/core.go (100%) rename {sail/examples => examples/sail-example}/internal/dao/dao.go (100%) rename {sail/examples => examples/sail-example}/internal/internal.go (100%) rename {sail/examples => examples/sail-example}/internal/model/model.go (100%) rename {sail/examples => examples/sail-example}/internal/servants/base/base.go (100%) rename {sail/examples => examples/sail-example}/internal/servants/bot/bot.go (84%) rename {sail/examples => examples/sail-example}/internal/servants/bot/user.go (74%) rename {sail/examples => examples/sail-example}/internal/servants/docs/docs.go (100%) rename {sail/examples => examples/sail-example}/internal/servants/docs/docs_embed.go (87%) rename {sail/examples => examples/sail-example}/internal/servants/servants.go (76%) rename {sail/examples => examples/sail-example}/internal/servants/web/admin_a.go (72%) rename {sail/examples => examples/sail-example}/internal/servants/web/site.go (73%) rename {sail/examples => examples/sail-example}/internal/servants/web/site_a.go (78%) rename {sail/examples => examples/sail-example}/internal/servants/web/site_b.go (72%) rename {sail/examples => examples/sail-example}/internal/servants/web/site_c.go (72%) rename {sail/examples => examples/sail-example}/internal/servants/web/web.go (70%) rename {sail/examples => examples/sail-example}/internal/service/bot.go (90%) rename {sail/examples => examples/sail-example}/internal/service/docs.go (90%) rename {sail/examples => examples/sail-example}/internal/service/service.go (94%) rename {sail/examples => examples/sail-example}/internal/service/web.go (90%) rename {sail/examples => examples/sail-example}/main.go (60%) rename {sail/examples => examples/sail-example}/mirc/bot/README.md (100%) rename {sail/examples => examples/sail-example}/mirc/bot/v1/user.go (100%) rename {sail/examples => examples/sail-example}/mirc/gen.go (71%) rename {sail/examples => examples/sail-example}/mirc/web/site.go (100%) rename {sail/examples => examples/sail-example}/mirc/web/v1/site.go (100%) rename {sail/examples => examples/sail-example}/mirc/web/v2/site.go (100%) rename {sail/examples => examples/sail-example}/mirc/web/v3/site.go (96%) rename {sail/examples => examples/sail-example}/pkg/debug/annotation.go (100%) rename {sail/examples => examples/sail-example}/pkg/debug/errors.go (100%) rename {sail/examples => examples/sail-example}/pkg/types/types.go (100%) rename {sail/examples => examples/sail-example}/pkg/utils/str.go (100%) rename {sail/examples => examples/sail-example}/pkg/utils/str_test.go (100%) rename {sail/examples => examples/sail-example}/pkg/utils/utils.go (100%) rename {sail/examples => examples/sail-example}/pkg/xerror/common.go (100%) rename {sail/examples => examples/sail-example}/pkg/xerror/xerror.go (100%) rename {sail/examples => examples/sail-example}/scripts/README (100%) rename {sail/examples => examples/sail-example}/scripts/docker/Dockerfile.backend-builder (100%) rename {sail/examples => examples/sail-example}/scripts/docker/Dockerfile.backend-runner (100%) rename {sail/examples => examples/sail-example}/scripts/docker/README.md (100%) rename {sail/examples => examples/sail-example}/scripts/examples-mysql.sql (100%) rename {sail/examples => examples/sail-example}/scripts/examples-postgres.sql (100%) rename {sail/examples => examples/sail-example}/scripts/examples-sqlite3.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/embed.go (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0001_initialize_schema.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0001_initialize_schema.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0002_post_visibility.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0002_post_visibility.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0003_feature_contact.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0003_feature_contact.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0004_optimize_idx.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0004_optimize_idx.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0005_share_count.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0005_share_count.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0006_topic_follow.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0006_topic_follow.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0007_comment_thumbs.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0007_comment_thumbs.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0008_content_type_alter.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0008_content_type_alter.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0009_create_view_post_filter.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0009_create_view_post_filter.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0010_user_following.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0010_user_following.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0011_home_timeline.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0011_home_timeline.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0012_comment_essence.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0012_comment_essence.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0013_rank_metrics.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0013_rank_metrics.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0014_user_relation_view.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0014_user_relation_view.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0015_topic_user_pin.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/mysql/0015_topic_user_pin.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0001_initialize_schema.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0001_initialize_schema.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0002_post_visibility.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0002_post_visibility.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0003_feature_contact.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0003_feature_contact.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0004_share_count.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0004_share_count.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0005_topic_follow.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0005_topic_follow.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0006_comment_thumbs.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0006_comment_thumbs.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0007_content_type_alter.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0007_content_type_alter.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0008_create_view_post_filter.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0008_create_view_post_filter.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0009_user_following.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0009_user_following.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0010_home_timeline.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0010_home_timeline.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0011_comment_essence.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0011_comment_essence.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0012_rank_metrics.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0012_rank_metrics.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0013_user_relation_view.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0013_user_relation_view.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0014_topic_user_pin.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/postgres/0014_topic_user_pin.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0001_initialize_schema.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0001_initialize_schema.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0002_post_visibility.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0002_post_visibility.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0003_feature_contact.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0003_feature_contact.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0004_optimize_idx.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0004_optimize_idx.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0005_share_count.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0005_share_count.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0006_topic_follow.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0006_topic_follow.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0007_comment_thumbs.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0007_comment_thumbs.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0008_content_type_alter.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0008_content_type_alter.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0009_create_view_post_filter.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0009_create_view_post_filter.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0010_user_following.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0010_user_following.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0011_home_timeline.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0011_home_timeline.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0012_comment_essence.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0012_comment_essence.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0013_rank_metrics.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0013_rank_metrics.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0014_user_relation_view.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0014_user_relation_view.up.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0015_topic_user_pin.down.sql (100%) rename {sail/examples => examples/sail-example}/scripts/migration/sqlite3/0015_topic_user_pin.up.sql (100%) delete mode 100644 sail/README.md delete mode 100644 sail/go.mod delete mode 100644 sail/go.sum delete mode 100644 sail/json/go_json.go delete mode 100644 sail/json/json.go delete mode 100644 sail/json/jsoniter.go delete mode 100644 sail/json/sonic.go create mode 100644 service/help.go rename {sail/service => service}/http_server.go (100%) rename {sail/service => service}/http_service.go (100%) rename {sail/service => service}/runtime.go (77%) rename {sail/service => service}/server.go (78%) rename {sail/service => service}/service.go (100%) diff --git a/examples/README.md b/examples/README.md index 82c46ea..4b34b1c 100644 --- a/examples/README.md +++ b/examples/README.md @@ -1,8 +1,6 @@ -## mir-examples -just a simple mir's examples for explain how to use mir in your project. +## Examples +Some example for mir. + +- [mir-example](mir-example) - simple minimal mir example for explain how to use mir. +- [sail-example](sail-example) - product least mir example for explain how to use mir in production enviroment. -#### Usage -```bash -% make generate -% make run -``` diff --git a/sail/examples/.gitignore b/examples/mir-example/.gitignore similarity index 95% rename from sail/examples/.gitignore rename to examples/mir-example/.gitignore index 0e88d49..0c3709e 100644 --- a/sail/examples/.gitignore +++ b/examples/mir-example/.gitignore @@ -1,5 +1,4 @@ # Binaries for programs and plugins -.DS_Store *.exe *.exe~ *.dll @@ -26,3 +25,4 @@ tmp.out .vscode /examples +/mir-example diff --git a/examples/Makefile b/examples/mir-example/Makefile similarity index 100% rename from examples/Makefile rename to examples/mir-example/Makefile diff --git a/examples/mir-example/README.md b/examples/mir-example/README.md new file mode 100644 index 0000000..82c46ea --- /dev/null +++ b/examples/mir-example/README.md @@ -0,0 +1,8 @@ +## mir-examples +just a simple mir's examples for explain how to use mir in your project. + +#### Usage +```bash +% make generate +% make run +``` diff --git a/examples/go.mod b/examples/mir-example/go.mod similarity index 94% rename from examples/go.mod rename to examples/mir-example/go.mod index c26a20a..da259b9 100644 --- a/examples/go.mod +++ b/examples/mir-example/go.mod @@ -1,4 +1,4 @@ -module github.com/alimy/mir/examples/v4 +module github.com/alimy/mir/mir-example/v4 go 1.21 @@ -38,4 +38,4 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace github.com/alimy/mir/v4 => ../ +replace github.com/alimy/mir/v4 => ../../ diff --git a/examples/go.sum b/examples/mir-example/go.sum similarity index 100% rename from examples/go.sum rename to examples/mir-example/go.sum diff --git a/examples/main.go b/examples/mir-example/main.go similarity index 89% rename from examples/main.go rename to examples/mir-example/main.go index 8c714cc..d330c58 100644 --- a/examples/main.go +++ b/examples/mir-example/main.go @@ -7,7 +7,7 @@ package main import ( "log" - "github.com/alimy/mir/examples/v4/servants" + "github.com/alimy/mir/mir-example/v4/servants" "github.com/gin-gonic/gin" ) diff --git a/examples/mirc/auto/api/site.go b/examples/mir-example/mirc/auto/api/site.go similarity index 100% rename from examples/mirc/auto/api/site.go rename to examples/mir-example/mirc/auto/api/site.go diff --git a/examples/mirc/auto/api/v1/admin.go b/examples/mir-example/mirc/auto/api/v1/admin.go similarity index 100% rename from examples/mirc/auto/api/v1/admin.go rename to examples/mir-example/mirc/auto/api/v1/admin.go diff --git a/examples/mirc/auto/api/v1/site.go b/examples/mir-example/mirc/auto/api/v1/site.go similarity index 100% rename from examples/mirc/auto/api/v1/site.go rename to examples/mir-example/mirc/auto/api/v1/site.go diff --git a/sail/examples/auto/api/v2/site.go b/examples/mir-example/mirc/auto/api/v2/site.go similarity index 100% rename from sail/examples/auto/api/v2/site.go rename to examples/mir-example/mirc/auto/api/v2/site.go index 041439a..29e2771 100644 --- a/sail/examples/auto/api/v2/site.go +++ b/examples/mir-example/mirc/auto/api/v2/site.go @@ -22,12 +22,12 @@ type _render_ interface { type _default_ interface { Bind(*gin.Context, any) mir.Error - BindYaml(*gin.Context, any) mir.Error BindJson(*gin.Context, any) mir.Error + BindYaml(*gin.Context, any) mir.Error Render(*gin.Context, any, mir.Error) - RenderXML(*gin.Context, any, mir.Error) RenderJsonp(*gin.Context, any, mir.Error) RenderJson(*gin.Context, any, mir.Error) + RenderXML(*gin.Context, any, mir.Error) } type LoginReq struct { diff --git a/examples/mirc/auto/api/v3/site.go b/examples/mir-example/mirc/auto/api/v3/site.go similarity index 99% rename from examples/mirc/auto/api/v3/site.go rename to examples/mir-example/mirc/auto/api/v3/site.go index 241fbef..628b947 100644 --- a/examples/mirc/auto/api/v3/site.go +++ b/examples/mir-example/mirc/auto/api/v3/site.go @@ -8,7 +8,7 @@ import ( "context" "net/http" - "github.com/alimy/mir/examples/v4/model" + "github.com/alimy/mir/mir-example/v4/model" "github.com/alimy/mir/v4" "github.com/gin-gonic/gin" ) diff --git a/examples/mirc/gen.go b/examples/mir-example/mirc/gen.go similarity index 75% rename from examples/mirc/gen.go rename to examples/mir-example/mirc/gen.go index d97158b..db226e1 100644 --- a/examples/mirc/gen.go +++ b/examples/mir-example/mirc/gen.go @@ -14,10 +14,10 @@ import ( . "github.com/alimy/mir/v4/engine" "github.com/gin-gonic/gin" - _ "github.com/alimy/mir/examples/v4/mirc/routes" - _ "github.com/alimy/mir/examples/v4/mirc/routes/v1" - _ "github.com/alimy/mir/examples/v4/mirc/routes/v2" - _ "github.com/alimy/mir/examples/v4/mirc/routes/v3" + _ "github.com/alimy/mir/mir-example/v4/mirc/routes" + _ "github.com/alimy/mir/mir-example/v4/mirc/routes/v1" + _ "github.com/alimy/mir/mir-example/v4/mirc/routes/v2" + _ "github.com/alimy/mir/mir-example/v4/mirc/routes/v3" ) //go:generate go run $GOFILE diff --git a/examples/mirc/routes/site.go b/examples/mir-example/mirc/routes/site.go similarity index 100% rename from examples/mirc/routes/site.go rename to examples/mir-example/mirc/routes/site.go diff --git a/examples/mirc/routes/v1/site.go b/examples/mir-example/mirc/routes/v1/site.go similarity index 100% rename from examples/mirc/routes/v1/site.go rename to examples/mir-example/mirc/routes/v1/site.go diff --git a/examples/mirc/routes/v2/site.go b/examples/mir-example/mirc/routes/v2/site.go similarity index 100% rename from examples/mirc/routes/v2/site.go rename to examples/mir-example/mirc/routes/v2/site.go diff --git a/examples/mirc/routes/v3/site.go b/examples/mir-example/mirc/routes/v3/site.go similarity index 97% rename from examples/mirc/routes/v3/site.go rename to examples/mir-example/mirc/routes/v3/site.go index 6dd8880..d2ee229 100644 --- a/examples/mirc/routes/v3/site.go +++ b/examples/mir-example/mirc/routes/v3/site.go @@ -5,7 +5,7 @@ package v3 import ( - "github.com/alimy/mir/examples/v4/model" + "github.com/alimy/mir/mir-example/v4/model" . "github.com/alimy/mir/v4" . "github.com/alimy/mir/v4/engine" ) diff --git a/examples/model/model.go b/examples/mir-example/model/model.go similarity index 100% rename from examples/model/model.go rename to examples/mir-example/model/model.go diff --git a/examples/servants/admin_a.go b/examples/mir-example/servants/admin_a.go similarity index 84% rename from examples/servants/admin_a.go rename to examples/mir-example/servants/admin_a.go index f447545..45c1a39 100644 --- a/examples/servants/admin_a.go +++ b/examples/mir-example/servants/admin_a.go @@ -5,7 +5,7 @@ package servants import ( - api "github.com/alimy/mir/examples/v4/mirc/auto/api/v1" + api "github.com/alimy/mir/mir-example/v4/mirc/auto/api/v1" ) type adminSrvA struct { diff --git a/examples/servants/core.go b/examples/mir-example/servants/core.go similarity index 100% rename from examples/servants/core.go rename to examples/mir-example/servants/core.go diff --git a/examples/servants/servants.go b/examples/mir-example/servants/servants.go similarity index 70% rename from examples/servants/servants.go rename to examples/mir-example/servants/servants.go index a721242..cfbe370 100644 --- a/examples/servants/servants.go +++ b/examples/mir-example/servants/servants.go @@ -5,10 +5,10 @@ package servants import ( - "github.com/alimy/mir/examples/v4/mirc/auto/api" - v1 "github.com/alimy/mir/examples/v4/mirc/auto/api/v1" - v2 "github.com/alimy/mir/examples/v4/mirc/auto/api/v2" - v3 "github.com/alimy/mir/examples/v4/mirc/auto/api/v3" + "github.com/alimy/mir/mir-example/v4/mirc/auto/api" + v1 "github.com/alimy/mir/mir-example/v4/mirc/auto/api/v1" + v2 "github.com/alimy/mir/mir-example/v4/mirc/auto/api/v2" + v3 "github.com/alimy/mir/mir-example/v4/mirc/auto/api/v3" "github.com/gin-gonic/gin" ) diff --git a/examples/servants/site.go b/examples/mir-example/servants/site.go similarity index 85% rename from examples/servants/site.go rename to examples/mir-example/servants/site.go index 44d9b7c..7e4ea81 100644 --- a/examples/servants/site.go +++ b/examples/mir-example/servants/site.go @@ -5,7 +5,7 @@ package servants import ( - "github.com/alimy/mir/examples/v4/mirc/auto/api" + "github.com/alimy/mir/mir-example/v4/mirc/auto/api" ) type siteSrv struct { diff --git a/examples/servants/site_a.go b/examples/mir-example/servants/site_a.go similarity index 88% rename from examples/servants/site_a.go rename to examples/mir-example/servants/site_a.go index 308c9e4..5700267 100644 --- a/examples/servants/site_a.go +++ b/examples/mir-example/servants/site_a.go @@ -5,7 +5,7 @@ package servants import ( - api "github.com/alimy/mir/examples/v4/mirc/auto/api/v1" + api "github.com/alimy/mir/mir-example/v4/mirc/auto/api/v1" ) type siteSrvA struct { diff --git a/examples/servants/site_b.go b/examples/mir-example/servants/site_b.go similarity index 84% rename from examples/servants/site_b.go rename to examples/mir-example/servants/site_b.go index 5947b48..57422a4 100644 --- a/examples/servants/site_b.go +++ b/examples/mir-example/servants/site_b.go @@ -5,7 +5,7 @@ package servants import ( - api "github.com/alimy/mir/examples/v4/mirc/auto/api/v2" + api "github.com/alimy/mir/mir-example/v4/mirc/auto/api/v2" ) type siteSrvB struct { diff --git a/examples/servants/site_c.go b/examples/mir-example/servants/site_c.go similarity index 84% rename from examples/servants/site_c.go rename to examples/mir-example/servants/site_c.go index d79a84e..3561ce4 100644 --- a/examples/servants/site_c.go +++ b/examples/mir-example/servants/site_c.go @@ -5,7 +5,7 @@ package servants import ( - api "github.com/alimy/mir/examples/v4/mirc/auto/api/v3" + api "github.com/alimy/mir/mir-example/v4/mirc/auto/api/v3" ) type siteSrvC struct { diff --git a/examples/.gitignore b/examples/sail-example/.gitignore similarity index 89% rename from examples/.gitignore rename to examples/sail-example/.gitignore index 2d94417..1b15fec 100644 --- a/examples/.gitignore +++ b/examples/sail-example/.gitignore @@ -1,4 +1,5 @@ # Binaries for programs and plugins +.DS_Store *.exe *.exe~ *.dll @@ -24,4 +25,5 @@ tmp.out # VS Code .vscode -examples \ No newline at end of file +/examples +/sail-example diff --git a/sail/examples/Dockerfile b/examples/sail-example/Dockerfile similarity index 100% rename from sail/examples/Dockerfile rename to examples/sail-example/Dockerfile diff --git a/sail/examples/Makefile b/examples/sail-example/Makefile similarity index 86% rename from sail/examples/Makefile rename to examples/sail-example/Makefile index efa5715..485fb5a 100644 --- a/sail/examples/Makefile +++ b/examples/sail-example/Makefile @@ -6,7 +6,7 @@ BUILD_VERSION := $(shell git describe --tags --always) BUILD_DATE := $(shell date +'%Y-%m-%d %H:%M:%S %Z') SHA_SHORT := $(shell git rev-parse --short HEAD) -MOD_NAME = github.com/alimy/mir/sail/examples/v4 +MOD_NAME = github.com/alimy/mir/sail-example/v4 LDFLAGS = -X "${MOD_NAME}/internal/conf.version=${BUILD_VERSION}" \ -X "${MOD_NAME}/internal/conf.buildDate=${BUILD_DATE}" \ -X "${MOD_NAME}/internal/conf.commitID=${SHA_SHORT}" \ @@ -18,7 +18,7 @@ default: serve .PHONY: build build: fmt - go build -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o examples main.go + go build -trimpath -tags '$(TAGS)' -ldflags '$(LDFLAGS)' -o sail-example main.go .PHONY: build serve: fmt diff --git a/sail/examples/README.md b/examples/sail-example/README.md similarity index 100% rename from sail/examples/README.md rename to examples/sail-example/README.md diff --git a/sail/examples/auto/api/bot/v1/user.go b/examples/sail-example/auto/api/bot/v1/user.go similarity index 100% rename from sail/examples/auto/api/bot/v1/user.go rename to examples/sail-example/auto/api/bot/v1/user.go diff --git a/sail/examples/auto/api/site.go b/examples/sail-example/auto/api/site.go similarity index 100% rename from sail/examples/auto/api/site.go rename to examples/sail-example/auto/api/site.go diff --git a/sail/examples/auto/api/v1/admin.go b/examples/sail-example/auto/api/v1/admin.go similarity index 100% rename from sail/examples/auto/api/v1/admin.go rename to examples/sail-example/auto/api/v1/admin.go diff --git a/sail/examples/auto/api/v1/site.go b/examples/sail-example/auto/api/v1/site.go similarity index 100% rename from sail/examples/auto/api/v1/site.go rename to examples/sail-example/auto/api/v1/site.go diff --git a/examples/mirc/auto/api/v2/site.go b/examples/sail-example/auto/api/v2/site.go similarity index 100% rename from examples/mirc/auto/api/v2/site.go rename to examples/sail-example/auto/api/v2/site.go index 82eed27..8a499cf 100644 --- a/examples/mirc/auto/api/v2/site.go +++ b/examples/sail-example/auto/api/v2/site.go @@ -25,9 +25,9 @@ type _default_ interface { BindJson(*gin.Context, any) mir.Error BindYaml(*gin.Context, any) mir.Error Render(*gin.Context, any, mir.Error) - RenderJson(*gin.Context, any, mir.Error) RenderXML(*gin.Context, any, mir.Error) RenderJsonp(*gin.Context, any, mir.Error) + RenderJson(*gin.Context, any, mir.Error) } type LoginReq struct { diff --git a/sail/examples/auto/api/v3/site.go b/examples/sail-example/auto/api/v3/site.go similarity index 99% rename from sail/examples/auto/api/v3/site.go rename to examples/sail-example/auto/api/v3/site.go index f2bb5b3..3e83a51 100644 --- a/sail/examples/auto/api/v3/site.go +++ b/examples/sail-example/auto/api/v3/site.go @@ -8,7 +8,7 @@ import ( "context" "net/http" - "github.com/alimy/mir/sail/examples/v4/internal/model" + "github.com/alimy/mir/sail-example/v4/internal/model" "github.com/alimy/mir/v4" "github.com/gin-gonic/gin" ) diff --git a/sail/examples/cmd/migrate/migrate.go b/examples/sail-example/cmd/migrate/migrate.go similarity index 93% rename from sail/examples/cmd/migrate/migrate.go rename to examples/sail-example/cmd/migrate/migrate.go index 5de4ad6..db65e2b 100644 --- a/sail/examples/cmd/migrate/migrate.go +++ b/examples/sail-example/cmd/migrate/migrate.go @@ -7,7 +7,7 @@ package migrate import ( "fmt" - "github.com/alimy/mir/sail/examples/v4/cmd" + "github.com/alimy/mir/sail-example/v4/cmd" "github.com/spf13/cobra" ) diff --git a/sail/examples/cmd/root.go b/examples/sail-example/cmd/root.go similarity index 100% rename from sail/examples/cmd/root.go rename to examples/sail-example/cmd/root.go diff --git a/sail/examples/cmd/serve/serve.go b/examples/sail-example/cmd/serve/serve.go similarity index 90% rename from sail/examples/cmd/serve/serve.go rename to examples/sail-example/cmd/serve/serve.go index 88e305e..c2a854e 100644 --- a/sail/examples/cmd/serve/serve.go +++ b/examples/sail-example/cmd/serve/serve.go @@ -11,9 +11,9 @@ import ( "os/signal" "syscall" - "github.com/alimy/mir/sail/examples/v4/cmd" - "github.com/alimy/mir/sail/examples/v4/internal/conf" - "github.com/alimy/mir/sail/examples/v4/internal/service" + "github.com/alimy/mir/sail-example/v4/cmd" + "github.com/alimy/mir/sail-example/v4/internal/conf" + "github.com/alimy/mir/sail-example/v4/internal/service" "github.com/fatih/color" "github.com/sourcegraph/conc" diff --git a/sail/examples/cmd/version.go b/examples/sail-example/cmd/version.go similarity index 90% rename from sail/examples/cmd/version.go rename to examples/sail-example/cmd/version.go index 0a2b6fb..e1acaab 100644 --- a/sail/examples/cmd/version.go +++ b/examples/sail-example/cmd/version.go @@ -7,7 +7,7 @@ package cmd import ( "fmt" - "github.com/alimy/mir/sail/examples/v4/internal/conf" + "github.com/alimy/mir/sail-example/v4/internal/conf" "github.com/spf13/cobra" ) diff --git a/sail/examples/config.yaml b/examples/sail-example/config.yaml similarity index 100% rename from sail/examples/config.yaml rename to examples/sail-example/config.yaml diff --git a/sail/examples/docs/README.md b/examples/sail-example/docs/README.md similarity index 100% rename from sail/examples/docs/README.md rename to examples/sail-example/docs/README.md diff --git a/sail/examples/docs/openapi/assets/rapidoc-min.js b/examples/sail-example/docs/openapi/assets/rapidoc-min.js similarity index 100% rename from sail/examples/docs/openapi/assets/rapidoc-min.js rename to examples/sail-example/docs/openapi/assets/rapidoc-min.js diff --git a/sail/examples/docs/openapi/embed.go b/examples/sail-example/docs/openapi/embed.go similarity index 100% rename from sail/examples/docs/openapi/embed.go rename to examples/sail-example/docs/openapi/embed.go diff --git a/sail/examples/docs/openapi/index.html b/examples/sail-example/docs/openapi/index.html similarity index 100% rename from sail/examples/docs/openapi/index.html rename to examples/sail-example/docs/openapi/index.html diff --git a/sail/examples/docs/openapi/openapi.json b/examples/sail-example/docs/openapi/openapi.json similarity index 100% rename from sail/examples/docs/openapi/openapi.json rename to examples/sail-example/docs/openapi/openapi.json diff --git a/sail/examples/go.mod b/examples/sail-example/go.mod similarity index 92% rename from sail/examples/go.mod rename to examples/sail-example/go.mod index ccf6a4f..79913a1 100644 --- a/sail/examples/go.mod +++ b/examples/sail-example/go.mod @@ -1,9 +1,8 @@ -module github.com/alimy/mir/sail/examples/v4 +module github.com/alimy/mir/sail-example/v4 go 1.21 require ( - github.com/alimy/mir/sail/v4 v4.2.0 github.com/alimy/mir/v4 v4.2.0 github.com/fatih/color v1.17.0 github.com/gin-gonic/gin v1.10.0 @@ -11,58 +10,52 @@ require ( github.com/spf13/cobra v1.8.0 ) -require ( - github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect - github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/magiconair/properties v1.8.7 // indirect - github.com/mitchellh/mapstructure v1.5.0 // indirect - github.com/sagikazarmark/locafero v0.4.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect - github.com/spf13/afero v1.11.0 // indirect - github.com/spf13/cast v1.6.0 // indirect - github.com/spf13/pflag v1.0.5 // indirect - github.com/subosito/gotenv v1.6.0 // indirect - go.uber.org/atomic v1.9.0 // indirect - go.uber.org/multierr v1.9.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect -) - require ( github.com/alimy/tryst v0.12.0 github.com/bytedance/sonic v1.11.7 // indirect github.com/bytedance/sonic/loader v0.1.1 // indirect github.com/cloudwego/base64x v0.1.4 // indirect github.com/cloudwego/iasm v0.2.0 // indirect + github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/gabriel-vasile/mimetype v1.4.3 // indirect github.com/gin-contrib/sse v0.1.0 // indirect github.com/go-playground/locales v0.14.1 // indirect github.com/go-playground/universal-translator v0.18.1 // indirect github.com/go-playground/validator/v10 v10.20.0 // indirect github.com/goccy/go-json v0.10.3 // indirect + github.com/hashicorp/hcl v1.0.0 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/json-iterator/go v1.1.12 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/leodido/go-urn v1.4.0 // indirect + github.com/magiconair/properties v1.8.7 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/sagikazarmark/locafero v0.4.0 // indirect + github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/spf13/afero v1.11.0 // indirect + github.com/spf13/cast v1.6.0 // indirect + github.com/spf13/pflag v1.0.5 // indirect github.com/spf13/viper v1.18.2 + github.com/subosito/gotenv v1.6.0 // indirect github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/ugorji/go/codec v1.2.12 // indirect + go.uber.org/atomic v1.9.0 // indirect go.uber.org/automaxprocs v1.5.3 + go.uber.org/multierr v1.9.0 // indirect golang.org/x/arch v0.8.0 // indirect golang.org/x/crypto v0.23.0 // indirect + golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect golang.org/x/net v0.25.0 // indirect golang.org/x/sys v0.20.0 // indirect golang.org/x/text v0.15.0 // indirect google.golang.org/protobuf v1.34.1 // indirect + gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) -replace ( - github.com/alimy/mir/sail/v4 => ../ - github.com/alimy/mir/v4 => ../../ -) +replace github.com/alimy/mir/v4 => ../../ diff --git a/sail/examples/go.sum b/examples/sail-example/go.sum similarity index 100% rename from sail/examples/go.sum rename to examples/sail-example/go.sum diff --git a/sail/examples/internal/conf/conf.go b/examples/sail-example/internal/conf/conf.go similarity index 98% rename from sail/examples/internal/conf/conf.go rename to examples/sail-example/internal/conf/conf.go index aabf711..9bde2e5 100644 --- a/sail/examples/internal/conf/conf.go +++ b/examples/sail-example/internal/conf/conf.go @@ -61,6 +61,7 @@ func Initial(suite []string, noDefault bool) { if err != nil { log.Fatalf("init.setupSetting err: %s", err) } + // setupMir() } func RunMode() string { diff --git a/sail/examples/internal/conf/config.yaml b/examples/sail-example/internal/conf/config.yaml similarity index 100% rename from sail/examples/internal/conf/config.yaml rename to examples/sail-example/internal/conf/config.yaml diff --git a/examples/sail-example/internal/conf/mir.go b/examples/sail-example/internal/conf/mir.go new file mode 100644 index 0000000..23b4c8e --- /dev/null +++ b/examples/sail-example/internal/conf/mir.go @@ -0,0 +1,10 @@ +package conf + +import ( + "github.com/alimy/mir/v4/service" + "github.com/fatih/color" +) + +func setupMir() { + service.SetOutput(color.Output) +} diff --git a/sail/examples/internal/conf/setting.go b/examples/sail-example/internal/conf/setting.go similarity index 100% rename from sail/examples/internal/conf/setting.go rename to examples/sail-example/internal/conf/setting.go diff --git a/sail/examples/internal/conf/version.go b/examples/sail-example/internal/conf/version.go similarity index 100% rename from sail/examples/internal/conf/version.go rename to examples/sail-example/internal/conf/version.go diff --git a/sail/examples/internal/core/core.go b/examples/sail-example/internal/core/core.go similarity index 100% rename from sail/examples/internal/core/core.go rename to examples/sail-example/internal/core/core.go diff --git a/sail/examples/internal/dao/dao.go b/examples/sail-example/internal/dao/dao.go similarity index 100% rename from sail/examples/internal/dao/dao.go rename to examples/sail-example/internal/dao/dao.go diff --git a/sail/examples/internal/internal.go b/examples/sail-example/internal/internal.go similarity index 100% rename from sail/examples/internal/internal.go rename to examples/sail-example/internal/internal.go diff --git a/sail/examples/internal/model/model.go b/examples/sail-example/internal/model/model.go similarity index 100% rename from sail/examples/internal/model/model.go rename to examples/sail-example/internal/model/model.go diff --git a/sail/examples/internal/servants/base/base.go b/examples/sail-example/internal/servants/base/base.go similarity index 100% rename from sail/examples/internal/servants/base/base.go rename to examples/sail-example/internal/servants/base/base.go diff --git a/sail/examples/internal/servants/bot/bot.go b/examples/sail-example/internal/servants/bot/bot.go similarity index 84% rename from sail/examples/internal/servants/bot/bot.go rename to examples/sail-example/internal/servants/bot/bot.go index 92407ac..0ca2502 100644 --- a/sail/examples/internal/servants/bot/bot.go +++ b/examples/sail-example/internal/servants/bot/bot.go @@ -5,7 +5,7 @@ package bot import ( - api "github.com/alimy/mir/sail/examples/v4/auto/api/bot/v1" + api "github.com/alimy/mir/sail-example/v4/auto/api/bot/v1" "github.com/gin-gonic/gin" ) diff --git a/sail/examples/internal/servants/bot/user.go b/examples/sail-example/internal/servants/bot/user.go similarity index 74% rename from sail/examples/internal/servants/bot/user.go rename to examples/sail-example/internal/servants/bot/user.go index 3c207d8..915b37a 100644 --- a/sail/examples/internal/servants/bot/user.go +++ b/examples/sail-example/internal/servants/bot/user.go @@ -5,8 +5,8 @@ package bot import ( - api "github.com/alimy/mir/sail/examples/v4/auto/api/bot/v1" - "github.com/alimy/mir/sail/examples/v4/internal/servants/base" + api "github.com/alimy/mir/sail-example/v4/auto/api/bot/v1" + "github.com/alimy/mir/sail-example/v4/internal/servants/base" ) var ( diff --git a/sail/examples/internal/servants/docs/docs.go b/examples/sail-example/internal/servants/docs/docs.go similarity index 100% rename from sail/examples/internal/servants/docs/docs.go rename to examples/sail-example/internal/servants/docs/docs.go diff --git a/sail/examples/internal/servants/docs/docs_embed.go b/examples/sail-example/internal/servants/docs/docs_embed.go similarity index 87% rename from sail/examples/internal/servants/docs/docs_embed.go rename to examples/sail-example/internal/servants/docs/docs_embed.go index c2dc99b..4c3d2aa 100644 --- a/sail/examples/internal/servants/docs/docs_embed.go +++ b/examples/sail-example/internal/servants/docs/docs_embed.go @@ -8,7 +8,7 @@ package docs import ( - "github.com/alimy/mir/sail/examples/v4/docs/openapi" + "github.com/alimy/mir/sail-example/v4/docs/openapi" "github.com/gin-gonic/gin" ) diff --git a/sail/examples/internal/servants/servants.go b/examples/sail-example/internal/servants/servants.go similarity index 76% rename from sail/examples/internal/servants/servants.go rename to examples/sail-example/internal/servants/servants.go index a4c7823..ce7b3fa 100644 --- a/sail/examples/internal/servants/servants.go +++ b/examples/sail-example/internal/servants/servants.go @@ -5,9 +5,9 @@ package servants import ( - "github.com/alimy/mir/sail/examples/v4/internal/servants/bot" - "github.com/alimy/mir/sail/examples/v4/internal/servants/docs" - "github.com/alimy/mir/sail/examples/v4/internal/servants/web" + "github.com/alimy/mir/sail-example/v4/internal/servants/bot" + "github.com/alimy/mir/sail-example/v4/internal/servants/docs" + "github.com/alimy/mir/sail-example/v4/internal/servants/web" "github.com/gin-gonic/gin" ) diff --git a/sail/examples/internal/servants/web/admin_a.go b/examples/sail-example/internal/servants/web/admin_a.go similarity index 72% rename from sail/examples/internal/servants/web/admin_a.go rename to examples/sail-example/internal/servants/web/admin_a.go index 35cf725..8d4d458 100644 --- a/sail/examples/internal/servants/web/admin_a.go +++ b/examples/sail-example/internal/servants/web/admin_a.go @@ -5,8 +5,8 @@ package web import ( - api "github.com/alimy/mir/sail/examples/v4/auto/api/v1" - "github.com/alimy/mir/sail/examples/v4/internal/servants/base" + api "github.com/alimy/mir/sail-example/v4/auto/api/v1" + "github.com/alimy/mir/sail-example/v4/internal/servants/base" ) type adminSrvA struct { diff --git a/sail/examples/internal/servants/web/site.go b/examples/sail-example/internal/servants/web/site.go similarity index 73% rename from sail/examples/internal/servants/web/site.go rename to examples/sail-example/internal/servants/web/site.go index d35d2cd..acb1be3 100644 --- a/sail/examples/internal/servants/web/site.go +++ b/examples/sail-example/internal/servants/web/site.go @@ -5,8 +5,8 @@ package web import ( - "github.com/alimy/mir/sail/examples/v4/auto/api" - "github.com/alimy/mir/sail/examples/v4/internal/servants/base" + "github.com/alimy/mir/sail-example/v4/auto/api" + "github.com/alimy/mir/sail-example/v4/internal/servants/base" ) type siteSrv struct { diff --git a/sail/examples/internal/servants/web/site_a.go b/examples/sail-example/internal/servants/web/site_a.go similarity index 78% rename from sail/examples/internal/servants/web/site_a.go rename to examples/sail-example/internal/servants/web/site_a.go index 2f020c5..3779dd8 100644 --- a/sail/examples/internal/servants/web/site_a.go +++ b/examples/sail-example/internal/servants/web/site_a.go @@ -5,8 +5,8 @@ package web import ( - api "github.com/alimy/mir/sail/examples/v4/auto/api/v1" - "github.com/alimy/mir/sail/examples/v4/internal/servants/base" + api "github.com/alimy/mir/sail-example/v4/auto/api/v1" + "github.com/alimy/mir/sail-example/v4/internal/servants/base" ) type siteSrvA struct { diff --git a/sail/examples/internal/servants/web/site_b.go b/examples/sail-example/internal/servants/web/site_b.go similarity index 72% rename from sail/examples/internal/servants/web/site_b.go rename to examples/sail-example/internal/servants/web/site_b.go index 417da47..b703f51 100644 --- a/sail/examples/internal/servants/web/site_b.go +++ b/examples/sail-example/internal/servants/web/site_b.go @@ -5,8 +5,8 @@ package web import ( - api "github.com/alimy/mir/sail/examples/v4/auto/api/v2" - "github.com/alimy/mir/sail/examples/v4/internal/servants/base" + api "github.com/alimy/mir/sail-example/v4/auto/api/v2" + "github.com/alimy/mir/sail-example/v4/internal/servants/base" ) type siteSrvB struct { diff --git a/sail/examples/internal/servants/web/site_c.go b/examples/sail-example/internal/servants/web/site_c.go similarity index 72% rename from sail/examples/internal/servants/web/site_c.go rename to examples/sail-example/internal/servants/web/site_c.go index bfedc91..e332d4b 100644 --- a/sail/examples/internal/servants/web/site_c.go +++ b/examples/sail-example/internal/servants/web/site_c.go @@ -5,8 +5,8 @@ package web import ( - api "github.com/alimy/mir/sail/examples/v4/auto/api/v3" - "github.com/alimy/mir/sail/examples/v4/internal/servants/base" + api "github.com/alimy/mir/sail-example/v4/auto/api/v3" + "github.com/alimy/mir/sail-example/v4/internal/servants/base" ) type siteSrvC struct { diff --git a/sail/examples/internal/servants/web/web.go b/examples/sail-example/internal/servants/web/web.go similarity index 70% rename from sail/examples/internal/servants/web/web.go rename to examples/sail-example/internal/servants/web/web.go index 6c9e178..fde88dd 100644 --- a/sail/examples/internal/servants/web/web.go +++ b/examples/sail-example/internal/servants/web/web.go @@ -5,10 +5,10 @@ package web import ( - "github.com/alimy/mir/sail/examples/v4/auto/api" - v1 "github.com/alimy/mir/sail/examples/v4/auto/api/v1" - v2 "github.com/alimy/mir/sail/examples/v4/auto/api/v2" - v3 "github.com/alimy/mir/sail/examples/v4/auto/api/v3" + "github.com/alimy/mir/sail-example/v4/auto/api" + v1 "github.com/alimy/mir/sail-example/v4/auto/api/v1" + v2 "github.com/alimy/mir/sail-example/v4/auto/api/v2" + v3 "github.com/alimy/mir/sail-example/v4/auto/api/v3" "github.com/gin-gonic/gin" ) diff --git a/sail/examples/internal/service/bot.go b/examples/sail-example/internal/service/bot.go similarity index 90% rename from sail/examples/internal/service/bot.go rename to examples/sail-example/internal/service/bot.go index b79c25e..76e2ea7 100644 --- a/sail/examples/internal/service/bot.go +++ b/examples/sail-example/internal/service/bot.go @@ -7,8 +7,8 @@ package service import ( "fmt" - "github.com/alimy/mir/sail/examples/v4/internal/servants" - "github.com/alimy/mir/sail/v4/service" + "github.com/alimy/mir/sail-example/v4/internal/servants" + "github.com/alimy/mir/v4/service" "github.com/fatih/color" "github.com/gin-gonic/gin" diff --git a/sail/examples/internal/service/docs.go b/examples/sail-example/internal/service/docs.go similarity index 90% rename from sail/examples/internal/service/docs.go rename to examples/sail-example/internal/service/docs.go index 8100963..f1fb5ba 100644 --- a/sail/examples/internal/service/docs.go +++ b/examples/sail-example/internal/service/docs.go @@ -7,8 +7,8 @@ package service import ( "fmt" - "github.com/alimy/mir/sail/examples/v4/internal/servants" - "github.com/alimy/mir/sail/v4/service" + "github.com/alimy/mir/sail-example/v4/internal/servants" + "github.com/alimy/mir/v4/service" "github.com/fatih/color" "github.com/gin-gonic/gin" diff --git a/sail/examples/internal/service/service.go b/examples/sail-example/internal/service/service.go similarity index 94% rename from sail/examples/internal/service/service.go rename to examples/sail-example/internal/service/service.go index 56954f5..c00113c 100644 --- a/sail/examples/internal/service/service.go +++ b/examples/sail-example/internal/service/service.go @@ -7,8 +7,8 @@ package service import ( "net/http" - "github.com/alimy/mir/sail/examples/v4/internal/conf" - sail "github.com/alimy/mir/sail/v4/service" + "github.com/alimy/mir/sail-example/v4/internal/conf" + sail "github.com/alimy/mir/v4/service" "github.com/alimy/tryst/cfg" "github.com/gin-gonic/gin" ) diff --git a/sail/examples/internal/service/web.go b/examples/sail-example/internal/service/web.go similarity index 90% rename from sail/examples/internal/service/web.go rename to examples/sail-example/internal/service/web.go index 0362f63..a1141a8 100644 --- a/sail/examples/internal/service/web.go +++ b/examples/sail-example/internal/service/web.go @@ -7,8 +7,8 @@ package service import ( "fmt" - "github.com/alimy/mir/sail/examples/v4/internal/servants" - "github.com/alimy/mir/sail/v4/service" + "github.com/alimy/mir/sail-example/v4/internal/servants" + "github.com/alimy/mir/v4/service" "github.com/fatih/color" "github.com/gin-gonic/gin" diff --git a/sail/examples/main.go b/examples/sail-example/main.go similarity index 60% rename from sail/examples/main.go rename to examples/sail-example/main.go index 7ba064b..0058532 100644 --- a/sail/examples/main.go +++ b/examples/sail-example/main.go @@ -5,9 +5,9 @@ package main import ( - "github.com/alimy/mir/sail/examples/v4/cmd" - _ "github.com/alimy/mir/sail/examples/v4/cmd/migrate" - _ "github.com/alimy/mir/sail/examples/v4/cmd/serve" + "github.com/alimy/mir/sail-example/v4/cmd" + _ "github.com/alimy/mir/sail-example/v4/cmd/migrate" + _ "github.com/alimy/mir/sail-example/v4/cmd/serve" ) func main() { diff --git a/sail/examples/mirc/bot/README.md b/examples/sail-example/mirc/bot/README.md similarity index 100% rename from sail/examples/mirc/bot/README.md rename to examples/sail-example/mirc/bot/README.md diff --git a/sail/examples/mirc/bot/v1/user.go b/examples/sail-example/mirc/bot/v1/user.go similarity index 100% rename from sail/examples/mirc/bot/v1/user.go rename to examples/sail-example/mirc/bot/v1/user.go diff --git a/sail/examples/mirc/gen.go b/examples/sail-example/mirc/gen.go similarity index 71% rename from sail/examples/mirc/gen.go rename to examples/sail-example/mirc/gen.go index 4a1c806..9fc1ffd 100644 --- a/sail/examples/mirc/gen.go +++ b/examples/sail-example/mirc/gen.go @@ -14,11 +14,11 @@ import ( . "github.com/alimy/mir/v4/engine" "github.com/gin-gonic/gin" - _ "github.com/alimy/mir/sail/examples/v4/mirc/bot/v1" - _ "github.com/alimy/mir/sail/examples/v4/mirc/web" - _ "github.com/alimy/mir/sail/examples/v4/mirc/web/v1" - _ "github.com/alimy/mir/sail/examples/v4/mirc/web/v2" - _ "github.com/alimy/mir/sail/examples/v4/mirc/web/v3" + _ "github.com/alimy/mir/sail-example/v4/mirc/bot/v1" + _ "github.com/alimy/mir/sail-example/v4/mirc/web" + _ "github.com/alimy/mir/sail-example/v4/mirc/web/v1" + _ "github.com/alimy/mir/sail-example/v4/mirc/web/v2" + _ "github.com/alimy/mir/sail-example/v4/mirc/web/v3" ) //go:generate go run $GOFILE diff --git a/sail/examples/mirc/web/site.go b/examples/sail-example/mirc/web/site.go similarity index 100% rename from sail/examples/mirc/web/site.go rename to examples/sail-example/mirc/web/site.go diff --git a/sail/examples/mirc/web/v1/site.go b/examples/sail-example/mirc/web/v1/site.go similarity index 100% rename from sail/examples/mirc/web/v1/site.go rename to examples/sail-example/mirc/web/v1/site.go diff --git a/sail/examples/mirc/web/v2/site.go b/examples/sail-example/mirc/web/v2/site.go similarity index 100% rename from sail/examples/mirc/web/v2/site.go rename to examples/sail-example/mirc/web/v2/site.go diff --git a/sail/examples/mirc/web/v3/site.go b/examples/sail-example/mirc/web/v3/site.go similarity index 96% rename from sail/examples/mirc/web/v3/site.go rename to examples/sail-example/mirc/web/v3/site.go index 4a15325..84429d1 100644 --- a/sail/examples/mirc/web/v3/site.go +++ b/examples/sail-example/mirc/web/v3/site.go @@ -5,7 +5,7 @@ package v3 import ( - "github.com/alimy/mir/sail/examples/v4/internal/model" + "github.com/alimy/mir/sail-example/v4/internal/model" . "github.com/alimy/mir/v4" . "github.com/alimy/mir/v4/engine" ) diff --git a/sail/examples/pkg/debug/annotation.go b/examples/sail-example/pkg/debug/annotation.go similarity index 100% rename from sail/examples/pkg/debug/annotation.go rename to examples/sail-example/pkg/debug/annotation.go diff --git a/sail/examples/pkg/debug/errors.go b/examples/sail-example/pkg/debug/errors.go similarity index 100% rename from sail/examples/pkg/debug/errors.go rename to examples/sail-example/pkg/debug/errors.go diff --git a/sail/examples/pkg/types/types.go b/examples/sail-example/pkg/types/types.go similarity index 100% rename from sail/examples/pkg/types/types.go rename to examples/sail-example/pkg/types/types.go diff --git a/sail/examples/pkg/utils/str.go b/examples/sail-example/pkg/utils/str.go similarity index 100% rename from sail/examples/pkg/utils/str.go rename to examples/sail-example/pkg/utils/str.go diff --git a/sail/examples/pkg/utils/str_test.go b/examples/sail-example/pkg/utils/str_test.go similarity index 100% rename from sail/examples/pkg/utils/str_test.go rename to examples/sail-example/pkg/utils/str_test.go diff --git a/sail/examples/pkg/utils/utils.go b/examples/sail-example/pkg/utils/utils.go similarity index 100% rename from sail/examples/pkg/utils/utils.go rename to examples/sail-example/pkg/utils/utils.go diff --git a/sail/examples/pkg/xerror/common.go b/examples/sail-example/pkg/xerror/common.go similarity index 100% rename from sail/examples/pkg/xerror/common.go rename to examples/sail-example/pkg/xerror/common.go diff --git a/sail/examples/pkg/xerror/xerror.go b/examples/sail-example/pkg/xerror/xerror.go similarity index 100% rename from sail/examples/pkg/xerror/xerror.go rename to examples/sail-example/pkg/xerror/xerror.go diff --git a/sail/examples/scripts/README b/examples/sail-example/scripts/README similarity index 100% rename from sail/examples/scripts/README rename to examples/sail-example/scripts/README diff --git a/sail/examples/scripts/docker/Dockerfile.backend-builder b/examples/sail-example/scripts/docker/Dockerfile.backend-builder similarity index 100% rename from sail/examples/scripts/docker/Dockerfile.backend-builder rename to examples/sail-example/scripts/docker/Dockerfile.backend-builder diff --git a/sail/examples/scripts/docker/Dockerfile.backend-runner b/examples/sail-example/scripts/docker/Dockerfile.backend-runner similarity index 100% rename from sail/examples/scripts/docker/Dockerfile.backend-runner rename to examples/sail-example/scripts/docker/Dockerfile.backend-runner diff --git a/sail/examples/scripts/docker/README.md b/examples/sail-example/scripts/docker/README.md similarity index 100% rename from sail/examples/scripts/docker/README.md rename to examples/sail-example/scripts/docker/README.md diff --git a/sail/examples/scripts/examples-mysql.sql b/examples/sail-example/scripts/examples-mysql.sql similarity index 100% rename from sail/examples/scripts/examples-mysql.sql rename to examples/sail-example/scripts/examples-mysql.sql diff --git a/sail/examples/scripts/examples-postgres.sql b/examples/sail-example/scripts/examples-postgres.sql similarity index 100% rename from sail/examples/scripts/examples-postgres.sql rename to examples/sail-example/scripts/examples-postgres.sql diff --git a/sail/examples/scripts/examples-sqlite3.sql b/examples/sail-example/scripts/examples-sqlite3.sql similarity index 100% rename from sail/examples/scripts/examples-sqlite3.sql rename to examples/sail-example/scripts/examples-sqlite3.sql diff --git a/sail/examples/scripts/migration/embed.go b/examples/sail-example/scripts/migration/embed.go similarity index 100% rename from sail/examples/scripts/migration/embed.go rename to examples/sail-example/scripts/migration/embed.go diff --git a/sail/examples/scripts/migration/mysql/0001_initialize_schema.down.sql b/examples/sail-example/scripts/migration/mysql/0001_initialize_schema.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0001_initialize_schema.down.sql rename to examples/sail-example/scripts/migration/mysql/0001_initialize_schema.down.sql diff --git a/sail/examples/scripts/migration/mysql/0001_initialize_schema.up.sql b/examples/sail-example/scripts/migration/mysql/0001_initialize_schema.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0001_initialize_schema.up.sql rename to examples/sail-example/scripts/migration/mysql/0001_initialize_schema.up.sql diff --git a/sail/examples/scripts/migration/mysql/0002_post_visibility.down.sql b/examples/sail-example/scripts/migration/mysql/0002_post_visibility.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0002_post_visibility.down.sql rename to examples/sail-example/scripts/migration/mysql/0002_post_visibility.down.sql diff --git a/sail/examples/scripts/migration/mysql/0002_post_visibility.up.sql b/examples/sail-example/scripts/migration/mysql/0002_post_visibility.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0002_post_visibility.up.sql rename to examples/sail-example/scripts/migration/mysql/0002_post_visibility.up.sql diff --git a/sail/examples/scripts/migration/mysql/0003_feature_contact.down.sql b/examples/sail-example/scripts/migration/mysql/0003_feature_contact.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0003_feature_contact.down.sql rename to examples/sail-example/scripts/migration/mysql/0003_feature_contact.down.sql diff --git a/sail/examples/scripts/migration/mysql/0003_feature_contact.up.sql b/examples/sail-example/scripts/migration/mysql/0003_feature_contact.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0003_feature_contact.up.sql rename to examples/sail-example/scripts/migration/mysql/0003_feature_contact.up.sql diff --git a/sail/examples/scripts/migration/mysql/0004_optimize_idx.down.sql b/examples/sail-example/scripts/migration/mysql/0004_optimize_idx.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0004_optimize_idx.down.sql rename to examples/sail-example/scripts/migration/mysql/0004_optimize_idx.down.sql diff --git a/sail/examples/scripts/migration/mysql/0004_optimize_idx.up.sql b/examples/sail-example/scripts/migration/mysql/0004_optimize_idx.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0004_optimize_idx.up.sql rename to examples/sail-example/scripts/migration/mysql/0004_optimize_idx.up.sql diff --git a/sail/examples/scripts/migration/mysql/0005_share_count.down.sql b/examples/sail-example/scripts/migration/mysql/0005_share_count.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0005_share_count.down.sql rename to examples/sail-example/scripts/migration/mysql/0005_share_count.down.sql diff --git a/sail/examples/scripts/migration/mysql/0005_share_count.up.sql b/examples/sail-example/scripts/migration/mysql/0005_share_count.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0005_share_count.up.sql rename to examples/sail-example/scripts/migration/mysql/0005_share_count.up.sql diff --git a/sail/examples/scripts/migration/mysql/0006_topic_follow.down.sql b/examples/sail-example/scripts/migration/mysql/0006_topic_follow.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0006_topic_follow.down.sql rename to examples/sail-example/scripts/migration/mysql/0006_topic_follow.down.sql diff --git a/sail/examples/scripts/migration/mysql/0006_topic_follow.up.sql b/examples/sail-example/scripts/migration/mysql/0006_topic_follow.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0006_topic_follow.up.sql rename to examples/sail-example/scripts/migration/mysql/0006_topic_follow.up.sql diff --git a/sail/examples/scripts/migration/mysql/0007_comment_thumbs.down.sql b/examples/sail-example/scripts/migration/mysql/0007_comment_thumbs.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0007_comment_thumbs.down.sql rename to examples/sail-example/scripts/migration/mysql/0007_comment_thumbs.down.sql diff --git a/sail/examples/scripts/migration/mysql/0007_comment_thumbs.up.sql b/examples/sail-example/scripts/migration/mysql/0007_comment_thumbs.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0007_comment_thumbs.up.sql rename to examples/sail-example/scripts/migration/mysql/0007_comment_thumbs.up.sql diff --git a/sail/examples/scripts/migration/mysql/0008_content_type_alter.down.sql b/examples/sail-example/scripts/migration/mysql/0008_content_type_alter.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0008_content_type_alter.down.sql rename to examples/sail-example/scripts/migration/mysql/0008_content_type_alter.down.sql diff --git a/sail/examples/scripts/migration/mysql/0008_content_type_alter.up.sql b/examples/sail-example/scripts/migration/mysql/0008_content_type_alter.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0008_content_type_alter.up.sql rename to examples/sail-example/scripts/migration/mysql/0008_content_type_alter.up.sql diff --git a/sail/examples/scripts/migration/mysql/0009_create_view_post_filter.down.sql b/examples/sail-example/scripts/migration/mysql/0009_create_view_post_filter.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0009_create_view_post_filter.down.sql rename to examples/sail-example/scripts/migration/mysql/0009_create_view_post_filter.down.sql diff --git a/sail/examples/scripts/migration/mysql/0009_create_view_post_filter.up.sql b/examples/sail-example/scripts/migration/mysql/0009_create_view_post_filter.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0009_create_view_post_filter.up.sql rename to examples/sail-example/scripts/migration/mysql/0009_create_view_post_filter.up.sql diff --git a/sail/examples/scripts/migration/mysql/0010_user_following.down.sql b/examples/sail-example/scripts/migration/mysql/0010_user_following.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0010_user_following.down.sql rename to examples/sail-example/scripts/migration/mysql/0010_user_following.down.sql diff --git a/sail/examples/scripts/migration/mysql/0010_user_following.up.sql b/examples/sail-example/scripts/migration/mysql/0010_user_following.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0010_user_following.up.sql rename to examples/sail-example/scripts/migration/mysql/0010_user_following.up.sql diff --git a/sail/examples/scripts/migration/mysql/0011_home_timeline.down.sql b/examples/sail-example/scripts/migration/mysql/0011_home_timeline.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0011_home_timeline.down.sql rename to examples/sail-example/scripts/migration/mysql/0011_home_timeline.down.sql diff --git a/sail/examples/scripts/migration/mysql/0011_home_timeline.up.sql b/examples/sail-example/scripts/migration/mysql/0011_home_timeline.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0011_home_timeline.up.sql rename to examples/sail-example/scripts/migration/mysql/0011_home_timeline.up.sql diff --git a/sail/examples/scripts/migration/mysql/0012_comment_essence.down.sql b/examples/sail-example/scripts/migration/mysql/0012_comment_essence.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0012_comment_essence.down.sql rename to examples/sail-example/scripts/migration/mysql/0012_comment_essence.down.sql diff --git a/sail/examples/scripts/migration/mysql/0012_comment_essence.up.sql b/examples/sail-example/scripts/migration/mysql/0012_comment_essence.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0012_comment_essence.up.sql rename to examples/sail-example/scripts/migration/mysql/0012_comment_essence.up.sql diff --git a/sail/examples/scripts/migration/mysql/0013_rank_metrics.down.sql b/examples/sail-example/scripts/migration/mysql/0013_rank_metrics.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0013_rank_metrics.down.sql rename to examples/sail-example/scripts/migration/mysql/0013_rank_metrics.down.sql diff --git a/sail/examples/scripts/migration/mysql/0013_rank_metrics.up.sql b/examples/sail-example/scripts/migration/mysql/0013_rank_metrics.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0013_rank_metrics.up.sql rename to examples/sail-example/scripts/migration/mysql/0013_rank_metrics.up.sql diff --git a/sail/examples/scripts/migration/mysql/0014_user_relation_view.down.sql b/examples/sail-example/scripts/migration/mysql/0014_user_relation_view.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0014_user_relation_view.down.sql rename to examples/sail-example/scripts/migration/mysql/0014_user_relation_view.down.sql diff --git a/sail/examples/scripts/migration/mysql/0014_user_relation_view.up.sql b/examples/sail-example/scripts/migration/mysql/0014_user_relation_view.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0014_user_relation_view.up.sql rename to examples/sail-example/scripts/migration/mysql/0014_user_relation_view.up.sql diff --git a/sail/examples/scripts/migration/mysql/0015_topic_user_pin.down.sql b/examples/sail-example/scripts/migration/mysql/0015_topic_user_pin.down.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0015_topic_user_pin.down.sql rename to examples/sail-example/scripts/migration/mysql/0015_topic_user_pin.down.sql diff --git a/sail/examples/scripts/migration/mysql/0015_topic_user_pin.up.sql b/examples/sail-example/scripts/migration/mysql/0015_topic_user_pin.up.sql similarity index 100% rename from sail/examples/scripts/migration/mysql/0015_topic_user_pin.up.sql rename to examples/sail-example/scripts/migration/mysql/0015_topic_user_pin.up.sql diff --git a/sail/examples/scripts/migration/postgres/0001_initialize_schema.down.sql b/examples/sail-example/scripts/migration/postgres/0001_initialize_schema.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0001_initialize_schema.down.sql rename to examples/sail-example/scripts/migration/postgres/0001_initialize_schema.down.sql diff --git a/sail/examples/scripts/migration/postgres/0001_initialize_schema.up.sql b/examples/sail-example/scripts/migration/postgres/0001_initialize_schema.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0001_initialize_schema.up.sql rename to examples/sail-example/scripts/migration/postgres/0001_initialize_schema.up.sql diff --git a/sail/examples/scripts/migration/postgres/0002_post_visibility.down.sql b/examples/sail-example/scripts/migration/postgres/0002_post_visibility.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0002_post_visibility.down.sql rename to examples/sail-example/scripts/migration/postgres/0002_post_visibility.down.sql diff --git a/sail/examples/scripts/migration/postgres/0002_post_visibility.up.sql b/examples/sail-example/scripts/migration/postgres/0002_post_visibility.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0002_post_visibility.up.sql rename to examples/sail-example/scripts/migration/postgres/0002_post_visibility.up.sql diff --git a/sail/examples/scripts/migration/postgres/0003_feature_contact.down.sql b/examples/sail-example/scripts/migration/postgres/0003_feature_contact.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0003_feature_contact.down.sql rename to examples/sail-example/scripts/migration/postgres/0003_feature_contact.down.sql diff --git a/sail/examples/scripts/migration/postgres/0003_feature_contact.up.sql b/examples/sail-example/scripts/migration/postgres/0003_feature_contact.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0003_feature_contact.up.sql rename to examples/sail-example/scripts/migration/postgres/0003_feature_contact.up.sql diff --git a/sail/examples/scripts/migration/postgres/0004_share_count.down.sql b/examples/sail-example/scripts/migration/postgres/0004_share_count.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0004_share_count.down.sql rename to examples/sail-example/scripts/migration/postgres/0004_share_count.down.sql diff --git a/sail/examples/scripts/migration/postgres/0004_share_count.up.sql b/examples/sail-example/scripts/migration/postgres/0004_share_count.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0004_share_count.up.sql rename to examples/sail-example/scripts/migration/postgres/0004_share_count.up.sql diff --git a/sail/examples/scripts/migration/postgres/0005_topic_follow.down.sql b/examples/sail-example/scripts/migration/postgres/0005_topic_follow.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0005_topic_follow.down.sql rename to examples/sail-example/scripts/migration/postgres/0005_topic_follow.down.sql diff --git a/sail/examples/scripts/migration/postgres/0005_topic_follow.up.sql b/examples/sail-example/scripts/migration/postgres/0005_topic_follow.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0005_topic_follow.up.sql rename to examples/sail-example/scripts/migration/postgres/0005_topic_follow.up.sql diff --git a/sail/examples/scripts/migration/postgres/0006_comment_thumbs.down.sql b/examples/sail-example/scripts/migration/postgres/0006_comment_thumbs.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0006_comment_thumbs.down.sql rename to examples/sail-example/scripts/migration/postgres/0006_comment_thumbs.down.sql diff --git a/sail/examples/scripts/migration/postgres/0006_comment_thumbs.up.sql b/examples/sail-example/scripts/migration/postgres/0006_comment_thumbs.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0006_comment_thumbs.up.sql rename to examples/sail-example/scripts/migration/postgres/0006_comment_thumbs.up.sql diff --git a/sail/examples/scripts/migration/postgres/0007_content_type_alter.down.sql b/examples/sail-example/scripts/migration/postgres/0007_content_type_alter.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0007_content_type_alter.down.sql rename to examples/sail-example/scripts/migration/postgres/0007_content_type_alter.down.sql diff --git a/sail/examples/scripts/migration/postgres/0007_content_type_alter.up.sql b/examples/sail-example/scripts/migration/postgres/0007_content_type_alter.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0007_content_type_alter.up.sql rename to examples/sail-example/scripts/migration/postgres/0007_content_type_alter.up.sql diff --git a/sail/examples/scripts/migration/postgres/0008_create_view_post_filter.down.sql b/examples/sail-example/scripts/migration/postgres/0008_create_view_post_filter.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0008_create_view_post_filter.down.sql rename to examples/sail-example/scripts/migration/postgres/0008_create_view_post_filter.down.sql diff --git a/sail/examples/scripts/migration/postgres/0008_create_view_post_filter.up.sql b/examples/sail-example/scripts/migration/postgres/0008_create_view_post_filter.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0008_create_view_post_filter.up.sql rename to examples/sail-example/scripts/migration/postgres/0008_create_view_post_filter.up.sql diff --git a/sail/examples/scripts/migration/postgres/0009_user_following.down.sql b/examples/sail-example/scripts/migration/postgres/0009_user_following.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0009_user_following.down.sql rename to examples/sail-example/scripts/migration/postgres/0009_user_following.down.sql diff --git a/sail/examples/scripts/migration/postgres/0009_user_following.up.sql b/examples/sail-example/scripts/migration/postgres/0009_user_following.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0009_user_following.up.sql rename to examples/sail-example/scripts/migration/postgres/0009_user_following.up.sql diff --git a/sail/examples/scripts/migration/postgres/0010_home_timeline.down.sql b/examples/sail-example/scripts/migration/postgres/0010_home_timeline.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0010_home_timeline.down.sql rename to examples/sail-example/scripts/migration/postgres/0010_home_timeline.down.sql diff --git a/sail/examples/scripts/migration/postgres/0010_home_timeline.up.sql b/examples/sail-example/scripts/migration/postgres/0010_home_timeline.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0010_home_timeline.up.sql rename to examples/sail-example/scripts/migration/postgres/0010_home_timeline.up.sql diff --git a/sail/examples/scripts/migration/postgres/0011_comment_essence.down.sql b/examples/sail-example/scripts/migration/postgres/0011_comment_essence.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0011_comment_essence.down.sql rename to examples/sail-example/scripts/migration/postgres/0011_comment_essence.down.sql diff --git a/sail/examples/scripts/migration/postgres/0011_comment_essence.up.sql b/examples/sail-example/scripts/migration/postgres/0011_comment_essence.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0011_comment_essence.up.sql rename to examples/sail-example/scripts/migration/postgres/0011_comment_essence.up.sql diff --git a/sail/examples/scripts/migration/postgres/0012_rank_metrics.down.sql b/examples/sail-example/scripts/migration/postgres/0012_rank_metrics.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0012_rank_metrics.down.sql rename to examples/sail-example/scripts/migration/postgres/0012_rank_metrics.down.sql diff --git a/sail/examples/scripts/migration/postgres/0012_rank_metrics.up.sql b/examples/sail-example/scripts/migration/postgres/0012_rank_metrics.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0012_rank_metrics.up.sql rename to examples/sail-example/scripts/migration/postgres/0012_rank_metrics.up.sql diff --git a/sail/examples/scripts/migration/postgres/0013_user_relation_view.down.sql b/examples/sail-example/scripts/migration/postgres/0013_user_relation_view.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0013_user_relation_view.down.sql rename to examples/sail-example/scripts/migration/postgres/0013_user_relation_view.down.sql diff --git a/sail/examples/scripts/migration/postgres/0013_user_relation_view.up.sql b/examples/sail-example/scripts/migration/postgres/0013_user_relation_view.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0013_user_relation_view.up.sql rename to examples/sail-example/scripts/migration/postgres/0013_user_relation_view.up.sql diff --git a/sail/examples/scripts/migration/postgres/0014_topic_user_pin.down.sql b/examples/sail-example/scripts/migration/postgres/0014_topic_user_pin.down.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0014_topic_user_pin.down.sql rename to examples/sail-example/scripts/migration/postgres/0014_topic_user_pin.down.sql diff --git a/sail/examples/scripts/migration/postgres/0014_topic_user_pin.up.sql b/examples/sail-example/scripts/migration/postgres/0014_topic_user_pin.up.sql similarity index 100% rename from sail/examples/scripts/migration/postgres/0014_topic_user_pin.up.sql rename to examples/sail-example/scripts/migration/postgres/0014_topic_user_pin.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0001_initialize_schema.down.sql b/examples/sail-example/scripts/migration/sqlite3/0001_initialize_schema.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0001_initialize_schema.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0001_initialize_schema.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0001_initialize_schema.up.sql b/examples/sail-example/scripts/migration/sqlite3/0001_initialize_schema.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0001_initialize_schema.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0001_initialize_schema.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0002_post_visibility.down.sql b/examples/sail-example/scripts/migration/sqlite3/0002_post_visibility.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0002_post_visibility.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0002_post_visibility.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0002_post_visibility.up.sql b/examples/sail-example/scripts/migration/sqlite3/0002_post_visibility.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0002_post_visibility.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0002_post_visibility.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0003_feature_contact.down.sql b/examples/sail-example/scripts/migration/sqlite3/0003_feature_contact.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0003_feature_contact.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0003_feature_contact.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0003_feature_contact.up.sql b/examples/sail-example/scripts/migration/sqlite3/0003_feature_contact.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0003_feature_contact.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0003_feature_contact.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0004_optimize_idx.down.sql b/examples/sail-example/scripts/migration/sqlite3/0004_optimize_idx.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0004_optimize_idx.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0004_optimize_idx.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0004_optimize_idx.up.sql b/examples/sail-example/scripts/migration/sqlite3/0004_optimize_idx.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0004_optimize_idx.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0004_optimize_idx.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0005_share_count.down.sql b/examples/sail-example/scripts/migration/sqlite3/0005_share_count.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0005_share_count.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0005_share_count.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0005_share_count.up.sql b/examples/sail-example/scripts/migration/sqlite3/0005_share_count.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0005_share_count.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0005_share_count.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0006_topic_follow.down.sql b/examples/sail-example/scripts/migration/sqlite3/0006_topic_follow.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0006_topic_follow.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0006_topic_follow.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0006_topic_follow.up.sql b/examples/sail-example/scripts/migration/sqlite3/0006_topic_follow.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0006_topic_follow.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0006_topic_follow.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0007_comment_thumbs.down.sql b/examples/sail-example/scripts/migration/sqlite3/0007_comment_thumbs.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0007_comment_thumbs.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0007_comment_thumbs.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0007_comment_thumbs.up.sql b/examples/sail-example/scripts/migration/sqlite3/0007_comment_thumbs.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0007_comment_thumbs.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0007_comment_thumbs.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0008_content_type_alter.down.sql b/examples/sail-example/scripts/migration/sqlite3/0008_content_type_alter.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0008_content_type_alter.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0008_content_type_alter.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0008_content_type_alter.up.sql b/examples/sail-example/scripts/migration/sqlite3/0008_content_type_alter.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0008_content_type_alter.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0008_content_type_alter.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0009_create_view_post_filter.down.sql b/examples/sail-example/scripts/migration/sqlite3/0009_create_view_post_filter.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0009_create_view_post_filter.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0009_create_view_post_filter.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0009_create_view_post_filter.up.sql b/examples/sail-example/scripts/migration/sqlite3/0009_create_view_post_filter.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0009_create_view_post_filter.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0009_create_view_post_filter.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0010_user_following.down.sql b/examples/sail-example/scripts/migration/sqlite3/0010_user_following.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0010_user_following.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0010_user_following.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0010_user_following.up.sql b/examples/sail-example/scripts/migration/sqlite3/0010_user_following.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0010_user_following.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0010_user_following.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0011_home_timeline.down.sql b/examples/sail-example/scripts/migration/sqlite3/0011_home_timeline.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0011_home_timeline.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0011_home_timeline.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0011_home_timeline.up.sql b/examples/sail-example/scripts/migration/sqlite3/0011_home_timeline.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0011_home_timeline.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0011_home_timeline.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0012_comment_essence.down.sql b/examples/sail-example/scripts/migration/sqlite3/0012_comment_essence.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0012_comment_essence.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0012_comment_essence.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0012_comment_essence.up.sql b/examples/sail-example/scripts/migration/sqlite3/0012_comment_essence.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0012_comment_essence.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0012_comment_essence.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0013_rank_metrics.down.sql b/examples/sail-example/scripts/migration/sqlite3/0013_rank_metrics.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0013_rank_metrics.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0013_rank_metrics.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0013_rank_metrics.up.sql b/examples/sail-example/scripts/migration/sqlite3/0013_rank_metrics.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0013_rank_metrics.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0013_rank_metrics.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0014_user_relation_view.down.sql b/examples/sail-example/scripts/migration/sqlite3/0014_user_relation_view.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0014_user_relation_view.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0014_user_relation_view.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0014_user_relation_view.up.sql b/examples/sail-example/scripts/migration/sqlite3/0014_user_relation_view.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0014_user_relation_view.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0014_user_relation_view.up.sql diff --git a/sail/examples/scripts/migration/sqlite3/0015_topic_user_pin.down.sql b/examples/sail-example/scripts/migration/sqlite3/0015_topic_user_pin.down.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0015_topic_user_pin.down.sql rename to examples/sail-example/scripts/migration/sqlite3/0015_topic_user_pin.down.sql diff --git a/sail/examples/scripts/migration/sqlite3/0015_topic_user_pin.up.sql b/examples/sail-example/scripts/migration/sqlite3/0015_topic_user_pin.up.sql similarity index 100% rename from sail/examples/scripts/migration/sqlite3/0015_topic_user_pin.up.sql rename to examples/sail-example/scripts/migration/sqlite3/0015_topic_user_pin.up.sql diff --git a/sail/README.md b/sail/README.md deleted file mode 100644 index 4959d3d..0000000 --- a/sail/README.md +++ /dev/null @@ -1,3 +0,0 @@ -### Sail -Sail contains some help function for http service that use mir. - \ No newline at end of file diff --git a/sail/go.mod b/sail/go.mod deleted file mode 100644 index 6d5b62d..0000000 --- a/sail/go.mod +++ /dev/null @@ -1,25 +0,0 @@ -module github.com/alimy/mir/sail/v4 - -go 1.21 - -require ( - github.com/bytedance/sonic v1.11.7 - github.com/fatih/color v1.17.0 - github.com/goccy/go-json v0.10.3 - github.com/json-iterator/go v1.1.12 - github.com/sourcegraph/conc v0.3.0 -) - -require ( - github.com/bytedance/sonic/loader v0.1.1 // indirect - github.com/cloudwego/base64x v0.1.4 // indirect - github.com/cloudwego/iasm v0.2.0 // indirect - github.com/klauspost/cpuid/v2 v2.0.9 // indirect - github.com/mattn/go-colorable v0.1.13 // indirect - github.com/mattn/go-isatty v0.0.20 // indirect - github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 // indirect - github.com/modern-go/reflect2 v1.0.2 // indirect - github.com/twitchyliquid64/golang-asm v0.15.1 // indirect - golang.org/x/arch v0.0.0-20210923205945-b76863e36670 // indirect - golang.org/x/sys v0.18.0 // indirect -) diff --git a/sail/go.sum b/sail/go.sum deleted file mode 100644 index bfcf3eb..0000000 --- a/sail/go.sum +++ /dev/null @@ -1,57 +0,0 @@ -github.com/bytedance/sonic v1.11.7 h1:k/l9p1hZpNIMJSk37wL9ltkcpqLfIho1vYthi4xT2t4= -github.com/bytedance/sonic v1.11.7/go.mod h1:LysEHSvpvDySVdC2f87zGWf6CIKJcAvqab1ZaiQtds4= -github.com/bytedance/sonic/loader v0.1.1 h1:c+e5Pt1k/cy5wMveRDyk2X4B9hF4g7an8N3zCYjJFNM= -github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/cloudwego/base64x v0.1.4 h1:jwCgWpFanWmN8xoIUHa2rtzmkd5J2plF/dnLS6Xd/0Y= -github.com/cloudwego/base64x v0.1.4/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= -github.com/cloudwego/iasm v0.2.0 h1:1KNIy1I1H9hNNFEEH3DVnI4UujN+1zjpuk6gwHLTssg= -github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= -github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/fatih/color v1.17.0 h1:GlRw1BRJxkpqUCBKzKOw098ed57fEsKeNjpTe3cSjK4= -github.com/fatih/color v1.17.0/go.mod h1:YZ7TlrGPkiz6ku9fK3TLD/pl3CpsiFyu8N92HLgmosI= -github.com/goccy/go-json v0.10.3 h1:KZ5WoDbxAIgm2HNbYckL0se1fHD6rz5j4ywS6ebzDqA= -github.com/goccy/go-json v0.10.3/go.mod h1:oq7eo15ShAhp70Anwd5lgX2pLfOS3QCiwU/PULtXL6M= -github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= -github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= -github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= -github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= -github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= -github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= -github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= -github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc= -github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= -github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= -github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= -github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/sourcegraph/conc v0.3.0 h1:OQTbbt6P72L20UqAkXXuLOj79LfEanQ+YQFNpLA9ySo= -github.com/sourcegraph/conc v0.3.0/go.mod h1:Sdozi7LEKbFPqYX2/J+iBAM6HpqSLTASQIKqDmF7Mt0= -github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= -github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= -github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= -github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= -github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk= -github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= -github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= -github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= -golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= -gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= -rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= diff --git a/sail/json/go_json.go b/sail/json/go_json.go deleted file mode 100644 index 23f7172..0000000 --- a/sail/json/go_json.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2017 Bo-Yi Wu. All rights reserved. -// Use of this source code is governed by a MIT style -// license that can be found in the LICENSE file. - -//go:build go_json -// +build go_json - -package json - -import json "github.com/goccy/go-json" - -var ( - // Marshal is exported by gin/json package. - Marshal = json.Marshal - // Unmarshal is exported by gin/json package. - Unmarshal = json.Unmarshal - // MarshalIndent is exported by gin/json package. - MarshalIndent = json.MarshalIndent - // NewDecoder is exported by gin/json package. - NewDecoder = json.NewDecoder - // NewEncoder is exported by gin/json package. - NewEncoder = json.NewEncoder -) diff --git a/sail/json/json.go b/sail/json/json.go deleted file mode 100644 index c5f3efc..0000000 --- a/sail/json/json.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2017 Bo-Yi Wu. All rights reserved. -// Use of this source code is governed by a MIT style -// license that can be found in the LICENSE file. - -//go:build !jsoniter && !go_json && !(sonic && avx && (linux || windows || darwin) && amd64) -// +build !jsoniter -// +build !go_json -// +build !sonic !avx !linux,!windows,!darwin !amd64 - -package json - -import "encoding/json" - -var ( - // Marshal is exported by gin/json package. - Marshal = json.Marshal - // Unmarshal is exported by gin/json package. - Unmarshal = json.Unmarshal - // MarshalIndent is exported by gin/json package. - MarshalIndent = json.MarshalIndent - // NewDecoder is exported by gin/json package. - NewDecoder = json.NewDecoder - // NewEncoder is exported by gin/json package. - NewEncoder = json.NewEncoder -) diff --git a/sail/json/jsoniter.go b/sail/json/jsoniter.go deleted file mode 100644 index 853b1a9..0000000 --- a/sail/json/jsoniter.go +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2017 Bo-Yi Wu. All rights reserved. -// Use of this source code is governed by a MIT style -// license that can be found in the LICENSE file. - -//go:build jsoniter -// +build jsoniter - -package json - -import jsoniter "github.com/json-iterator/go" - -var ( - json = jsoniter.ConfigCompatibleWithStandardLibrary - // Marshal is exported by gin/json package. - Marshal = json.Marshal - // Unmarshal is exported by gin/json package. - Unmarshal = json.Unmarshal - // MarshalIndent is exported by gin/json package. - MarshalIndent = json.MarshalIndent - // NewDecoder is exported by gin/json package. - NewDecoder = json.NewDecoder - // NewEncoder is exported by gin/json package. - NewEncoder = json.NewEncoder -) diff --git a/sail/json/sonic.go b/sail/json/sonic.go deleted file mode 100644 index 5a9ca4b..0000000 --- a/sail/json/sonic.go +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2022 Gin Core Team. All rights reserved. -// Use of this source code is governed by a MIT style -// license that can be found in the LICENSE file. - -//go:build sonic && avx && (linux || windows || darwin) && amd64 -// +build sonic -// +build avx -// +build linux windows darwin -// +build amd64 - -package json - -import "github.com/bytedance/sonic" - -var ( - json = sonic.ConfigStd - // Marshal is exported by gin/json package. - Marshal = json.Marshal - // Unmarshal is exported by gin/json package. - Unmarshal = json.Unmarshal - // MarshalIndent is exported by gin/json package. - MarshalIndent = json.MarshalIndent - // NewDecoder is exported by gin/json package. - NewDecoder = json.NewDecoder - // NewEncoder is exported by gin/json package. - NewEncoder = json.NewEncoder -) diff --git a/service/help.go b/service/help.go new file mode 100644 index 0000000..89405e0 --- /dev/null +++ b/service/help.go @@ -0,0 +1,17 @@ +package service + +import ( + "io" + "os" +) + +var ( + _output io.Writer = os.Stdout +) + +// SetOutput set log output writer. default is os.Stdout +func SetOutput(w io.Writer) { + if w != nil { + _output = w + } +} diff --git a/sail/service/http_server.go b/service/http_server.go similarity index 100% rename from sail/service/http_server.go rename to service/http_server.go diff --git a/sail/service/http_service.go b/service/http_service.go similarity index 100% rename from sail/service/http_service.go rename to service/http_service.go diff --git a/sail/service/runtime.go b/service/runtime.go similarity index 77% rename from sail/service/runtime.go rename to service/runtime.go index 6400fa6..d5246df 100644 --- a/sail/service/runtime.go +++ b/service/runtime.go @@ -4,9 +4,10 @@ package service -import "github.com/sourcegraph/conc" - +type Launch interface { + Go(func()) +} type Runtime interface { - Start(wg *conc.WaitGroup) + Start(Launch) Stop() } diff --git a/sail/service/server.go b/service/server.go similarity index 78% rename from sail/service/server.go rename to service/server.go index 81bfaaf..ad5c389 100644 --- a/sail/service/server.go +++ b/service/server.go @@ -7,9 +7,6 @@ package service import ( "fmt" "net/http" - - "github.com/fatih/color" - "github.com/sourcegraph/conc" ) var ( @@ -73,10 +70,10 @@ func (s *baseServer) services() (ss []Service) { } // Start start all servers -func (p *ServerPool[T]) Start(wg *conc.WaitGroup) { +func (p *ServerPool[T]) Start(wg Launch) { srvSize, maxSidSize := p.checkServices() if srvSize < 1 { - fmt.Fprintln(color.Output, "[noop] - service list is empty so do nothing") + fmt.Fprintln(_output, "[noop] - service list is empty so do nothing") return } @@ -104,7 +101,7 @@ func (p *ServerPool[T]) from(addr string, newServer func() T) T { return s } -func (p *ServerPool[T]) startServer(wg *conc.WaitGroup, maxSidSize int) { +func (p *ServerPool[T]) startServer(wg Launch, maxSidSize int) { for _, srv := range p.servers { ss := srv.services() if len(ss) == 0 { @@ -151,26 +148,26 @@ func (p *ServerPool[T]) colorPrint(act byte, err error, l int, ss ...Service) { switch act { case _actOnStart: if err == nil { - fmt.Fprintf(color.Output, "%s [start] - %s", p.sidStr(s.Name(), s.Version(), l), s) + fmt.Fprintf(_output, "%s [start] - %s", p.sidStr(s.Name(), s.Version(), l), s) } else { - fmt.Fprintf(color.Output, "%s [start] - run OnStart error: %s\n", p.sidStr(s.Name(), s.Version(), l), err) + fmt.Fprintf(_output, "%s [start] - run OnStart error: %s\n", p.sidStr(s.Name(), s.Version(), l), err) } case _actOnStop: if err == nil { - fmt.Fprintf(color.Output, "%s [stop] - finish...\n", p.sidStr(s.Name(), s.Version(), l)) + fmt.Fprintf(_output, "%s [stop] - finish...\n", p.sidStr(s.Name(), s.Version(), l)) } else { - fmt.Fprintf(color.Output, "%s [stop] - run OnStop error: %s\n", p.sidStr(s.Name(), s.Version(), l), err) + fmt.Fprintf(_output, "%s [stop] - run OnStop error: %s\n", p.sidStr(s.Name(), s.Version(), l), err) } case _actStart: if err != nil { for _, s = range ss { - fmt.Fprintf(color.Output, "%s [start] - starting server occurs error: %s\n", p.sidStr(s.Name(), s.Version(), l), err) + fmt.Fprintf(_output, "%s [start] - starting server occurs error: %s\n", p.sidStr(s.Name(), s.Version(), l), err) } } case _actStop: if err != nil { for _, s = range ss { - fmt.Fprintf(color.Output, "%s [stop] - stopping server occurs error: %s\n", p.sidStr(s.Name(), s.Version(), l), err) + fmt.Fprintf(_output, "%s [stop] - stopping server occurs error: %s\n", p.sidStr(s.Name(), s.Version(), l), err) } } } @@ -178,14 +175,17 @@ func (p *ServerPool[T]) colorPrint(act byte, err error, l int, ss ...Service) { // maxSidSize max service id string length func (p *ServerPool[T]) maxSidSize(ss []Service) int { - length := 0 + length, verSize, tacitVerSize := 0, 0, len("0.0.0") for _, s := range ss { size := len(s.Name() + "@" + s.Version()) if size > length { length = size } + if cs := len(s.Version()); verSize < cs { + verSize = cs + } } - return length + return length + (verSize - tacitVerSize) } func (p *ServerPool[T]) sidStr(name string, version string, size int) string { diff --git a/sail/service/service.go b/service/service.go similarity index 100% rename from sail/service/service.go rename to service/service.go