├── docs ├── .gitignore ├── themes │ └── hugo-book │ │ ├── layouts │ │ ├── partials │ │ │ └── docs │ │ │ │ ├── inject │ │ │ │ ├── body.html │ │ │ │ ├── footer.html │ │ │ │ ├── head.html │ │ │ │ ├── menu-after.html │ │ │ │ ├── menu-before.html │ │ │ │ ├── toc-after.html │ │ │ │ ├── toc-before.html │ │ │ │ ├── content-after.html │ │ │ │ └── content-before.html │ │ │ │ ├── html-head-title.html │ │ │ │ ├── toc.html │ │ │ │ ├── comments.html │ │ │ │ ├── date.html │ │ │ │ ├── menu-bundle.html │ │ │ │ ├── brand.html │ │ │ │ ├── search.html │ │ │ │ ├── header.html │ │ │ │ ├── title.html │ │ │ │ ├── taxonomy.html │ │ │ │ ├── post-meta.html │ │ │ │ └── menu-hugo.html │ │ ├── _default │ │ │ ├── list.html │ │ │ ├── single.html │ │ │ └── _markup │ │ │ │ └── render-heading.html │ │ ├── shortcodes │ │ │ ├── hint.html │ │ │ ├── columns.html │ │ │ ├── section.html │ │ │ ├── details.html │ │ │ ├── tab.html │ │ │ ├── button.html │ │ │ ├── mermaid.html │ │ │ ├── expand.html │ │ │ ├── tabs.html │ │ │ └── katex.html │ │ ├── posts │ │ │ ├── single.html │ │ │ └── list.html │ │ └── taxonomy │ │ │ ├── list.html │ │ │ └── taxonomy.html │ │ ├── go.mod │ │ ├── assets │ │ ├── themes │ │ │ ├── _dark.scss │ │ │ ├── _light.scss │ │ │ └── _auto.scss │ │ ├── _custom.scss │ │ ├── _variables.scss │ │ ├── mermaid.json │ │ ├── sw-register.js │ │ ├── menu-reset.js │ │ ├── _print.scss │ │ ├── book.scss │ │ ├── manifest.json │ │ ├── plugins │ │ │ └── _scrollbars.scss │ │ ├── clipboard.js │ │ └── search-data.json │ │ ├── .gitignore │ │ ├── exampleSite │ │ ├── assets │ │ │ ├── _variables.scss │ │ │ └── _custom.scss │ │ ├── content.en │ │ │ ├── docs │ │ │ │ ├── shortcodes │ │ │ │ │ ├── _index.md │ │ │ │ │ ├── section │ │ │ │ │ │ ├── _index.md │ │ │ │ │ │ ├── first-page.md │ │ │ │ │ │ └── second-page.md │ │ │ │ │ ├── buttons.md │ │ │ │ │ └── details.md │ │ │ │ └── example │ │ │ │ │ └── collapsed │ │ │ │ │ ├── _index.md │ │ │ │ │ └── 3rd-level │ │ │ │ │ └── 4th-level.md │ │ │ └── posts │ │ │ │ └── _index.md │ │ └── resources │ │ │ └── _gen │ │ │ └── assets │ │ │ └── scss │ │ │ └── book.scss_e129fe35b8d0a70789c8a08429469073.json │ │ ├── images │ │ ├── tn.png │ │ └── screenshot.png │ │ ├── static │ │ ├── favicon.png │ │ ├── fonts │ │ │ ├── roboto-v27-latin-700.woff │ │ │ ├── roboto-v27-latin-700.woff2 │ │ │ ├── roboto-v27-latin-regular.woff │ │ │ ├── roboto-v27-latin-regular.woff2 │ │ │ ├── roboto-mono-v13-latin-regular.woff │ │ │ └── roboto-mono-v13-latin-regular.woff2 │ │ ├── katex │ │ │ └── fonts │ │ │ │ ├── KaTeX_Main-Bold.ttf │ │ │ │ ├── KaTeX_Main-Bold.woff │ │ │ │ ├── KaTeX_AMS-Regular.ttf │ │ │ │ ├── KaTeX_AMS-Regular.woff │ │ │ │ ├── KaTeX_AMS-Regular.woff2 │ │ │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ │ │ ├── KaTeX_Fraktur-Bold.woff │ │ │ │ ├── KaTeX_Main-Bold.woff2 │ │ │ │ ├── KaTeX_Main-Italic.ttf │ │ │ │ ├── KaTeX_Main-Italic.woff │ │ │ │ ├── KaTeX_Main-Italic.woff2 │ │ │ │ ├── KaTeX_Main-Regular.ttf │ │ │ │ ├── KaTeX_Main-Regular.woff │ │ │ │ ├── KaTeX_Math-Italic.ttf │ │ │ │ ├── KaTeX_Math-Italic.woff │ │ │ │ ├── KaTeX_Math-Italic.woff2 │ │ │ │ ├── KaTeX_Size1-Regular.ttf │ │ │ │ ├── KaTeX_Size2-Regular.ttf │ │ │ │ ├── KaTeX_Size3-Regular.ttf │ │ │ │ ├── KaTeX_Size4-Regular.ttf │ │ │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ │ │ ├── KaTeX_Main-BoldItalic.ttf │ │ │ │ ├── KaTeX_Main-Regular.woff2 │ │ │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ │ │ ├── KaTeX_SansSerif-Bold.woff │ │ │ │ ├── KaTeX_Script-Regular.ttf │ │ │ │ ├── KaTeX_Script-Regular.woff │ │ │ │ ├── KaTeX_Size1-Regular.woff │ │ │ │ ├── KaTeX_Size1-Regular.woff2 │ │ │ │ ├── KaTeX_Size2-Regular.woff │ │ │ │ ├── KaTeX_Size2-Regular.woff2 │ │ │ │ ├── KaTeX_Size3-Regular.woff │ │ │ │ ├── KaTeX_Size3-Regular.woff2 │ │ │ │ ├── KaTeX_Size4-Regular.woff │ │ │ │ ├── KaTeX_Size4-Regular.woff2 │ │ │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ │ │ ├── KaTeX_Fraktur-Regular.woff │ │ │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ │ │ ├── KaTeX_Main-BoldItalic.woff │ │ │ │ ├── KaTeX_Main-BoldItalic.woff2 │ │ │ │ ├── KaTeX_Math-BoldItalic.woff │ │ │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ │ │ ├── KaTeX_SansSerif-Italic.woff │ │ │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ │ │ ├── KaTeX_SansSerif-Regular.woff │ │ │ │ ├── KaTeX_Script-Regular.woff2 │ │ │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ │ │ ├── KaTeX_Typewriter-Regular.woff │ │ │ │ ├── KaTeX_Typewriter-Regular.woff2 │ │ │ │ └── KaTeX_Caligraphic-Regular.woff2 │ │ ├── favicon.svg │ │ └── svg │ │ │ ├── menu.svg │ │ │ ├── toc.svg │ │ │ ├── calendar.svg │ │ │ ├── edit.svg │ │ │ └── translate.svg │ │ ├── archetypes │ │ ├── posts.md │ │ └── docs.md │ │ ├── i18n │ │ ├── am.yaml │ │ ├── en.yaml │ │ ├── nb.yaml │ │ ├── pt.yaml │ │ ├── tr.yaml │ │ ├── de.yaml │ │ ├── es.yaml │ │ ├── it.yaml │ │ ├── sv.yaml │ │ ├── cs.yaml │ │ ├── fr.yaml │ │ ├── bn.yaml │ │ ├── uk.yaml │ │ ├── ru.yaml │ │ ├── zh.yaml │ │ ├── ja.yaml │ │ ├── zh-TW.yaml │ │ ├── ko.yaml │ │ ├── cn.yaml │ │ ├── jp.yaml │ │ └── fa.yaml │ │ └── theme.toml ├── content.en │ ├── menu │ │ └── index.md │ └── docs │ │ ├── tutorials │ │ ├── _index.md │ │ ├── app-start.md │ │ ├── servant-register.md │ │ └── interface-define.md │ │ ├── recommends │ │ └── _index.md │ │ └── quick-start │ │ └── projects-use-go-mir.md ├── content.zh │ ├── menu │ │ └── index.md │ └── docs │ │ ├── tutorials │ │ ├── _index.md │ │ ├── app-start.md │ │ └── servant-register.md │ │ ├── recommends │ │ └── _index.md │ │ └── quck-start │ │ └── projects-use-go-mir.md ├── assets │ ├── _variables.scss │ └── _custom.scss ├── public │ ├── favicon.png │ ├── images │ │ ├── mir-arc.png │ │ ├── mir-logo.png │ │ └── logo-origin.jpeg │ ├── fonts │ │ ├── roboto-v27-latin-700.woff │ │ ├── roboto-v27-latin-700.woff2 │ │ ├── roboto-v27-latin-regular.woff │ │ ├── roboto-v27-latin-regular.woff2 │ │ ├── roboto-mono-v13-latin-regular.woff │ │ └── roboto-mono-v13-latin-regular.woff2 │ ├── katex │ │ └── fonts │ │ │ ├── KaTeX_Main-Bold.ttf │ │ │ ├── KaTeX_Main-Bold.woff │ │ │ ├── KaTeX_AMS-Regular.ttf │ │ │ ├── KaTeX_AMS-Regular.woff │ │ │ ├── KaTeX_Fraktur-Bold.ttf │ │ │ ├── KaTeX_Main-Bold.woff2 │ │ │ ├── KaTeX_Main-Italic.ttf │ │ │ ├── KaTeX_Main-Italic.woff │ │ │ ├── KaTeX_Main-Regular.ttf │ │ │ ├── KaTeX_Math-Italic.ttf │ │ │ ├── KaTeX_Math-Italic.woff │ │ │ ├── KaTeX_AMS-Regular.woff2 │ │ │ ├── KaTeX_Fraktur-Bold.woff │ │ │ ├── KaTeX_Fraktur-Bold.woff2 │ │ │ ├── KaTeX_Fraktur-Regular.ttf │ │ │ ├── KaTeX_Main-BoldItalic.ttf │ │ │ ├── KaTeX_Main-Italic.woff2 │ │ │ ├── KaTeX_Main-Regular.woff │ │ │ ├── KaTeX_Main-Regular.woff2 │ │ │ ├── KaTeX_Math-BoldItalic.ttf │ │ │ ├── KaTeX_Math-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Bold.ttf │ │ │ ├── KaTeX_SansSerif-Bold.woff │ │ │ ├── KaTeX_Script-Regular.ttf │ │ │ ├── KaTeX_Script-Regular.woff │ │ │ ├── KaTeX_Size1-Regular.ttf │ │ │ ├── KaTeX_Size1-Regular.woff │ │ │ ├── KaTeX_Size1-Regular.woff2 │ │ │ ├── KaTeX_Size2-Regular.ttf │ │ │ ├── KaTeX_Size2-Regular.woff │ │ │ ├── KaTeX_Size2-Regular.woff2 │ │ │ ├── KaTeX_Size3-Regular.ttf │ │ │ ├── KaTeX_Size3-Regular.woff │ │ │ ├── KaTeX_Size3-Regular.woff2 │ │ │ ├── KaTeX_Size4-Regular.ttf │ │ │ ├── KaTeX_Size4-Regular.woff │ │ │ ├── KaTeX_Size4-Regular.woff2 │ │ │ ├── KaTeX_Caligraphic-Bold.ttf │ │ │ ├── KaTeX_Caligraphic-Bold.woff │ │ │ ├── KaTeX_Fraktur-Regular.woff │ │ │ ├── KaTeX_Fraktur-Regular.woff2 │ │ │ ├── KaTeX_Main-BoldItalic.woff │ │ │ ├── KaTeX_Main-BoldItalic.woff2 │ │ │ ├── KaTeX_Math-BoldItalic.woff │ │ │ ├── KaTeX_Math-BoldItalic.woff2 │ │ │ ├── KaTeX_SansSerif-Bold.woff2 │ │ │ ├── KaTeX_SansSerif-Italic.ttf │ │ │ ├── KaTeX_SansSerif-Italic.woff │ │ │ ├── KaTeX_SansSerif-Regular.ttf │ │ │ ├── KaTeX_Script-Regular.woff2 │ │ │ ├── KaTeX_Caligraphic-Bold.woff2 │ │ │ ├── KaTeX_Caligraphic-Regular.ttf │ │ │ ├── KaTeX_Caligraphic-Regular.woff │ │ │ ├── KaTeX_SansSerif-Italic.woff2 │ │ │ ├── KaTeX_SansSerif-Regular.woff │ │ │ ├── KaTeX_SansSerif-Regular.woff2 │ │ │ ├── KaTeX_Typewriter-Regular.ttf │ │ │ ├── KaTeX_Typewriter-Regular.woff │ │ │ ├── KaTeX_Typewriter-Regular.woff2 │ │ │ └── KaTeX_Caligraphic-Regular.woff2 │ ├── sw.min.cc53640256a4c5a819e5408f192a460fbdab1162f59e2640475ed9eaeba2a25b.js │ ├── favicon.svg │ ├── svg │ │ ├── menu.svg │ │ ├── toc.svg │ │ ├── calendar.svg │ │ ├── edit.svg │ │ └── translate.svg │ ├── zh │ │ └── index.html │ ├── tags │ │ ├── page │ │ │ └── 1 │ │ │ │ └── index.html │ │ └── index.xml │ ├── en │ │ ├── tags │ │ │ ├── page │ │ │ │ └── 1 │ │ │ │ │ └── index.html │ │ │ └── index.xml │ │ ├── categories │ │ │ ├── page │ │ │ │ └── 1 │ │ │ │ │ └── index.html │ │ │ └── index.xml │ │ └── docs │ │ │ ├── index.xml │ │ │ └── recommends │ │ │ └── index.xml │ ├── categories │ │ ├── page │ │ │ └── 1 │ │ │ │ └── index.html │ │ └── index.xml │ ├── manifest.json │ ├── sitemap.xml │ └── docs │ │ ├── index.xml │ │ └── recommends │ │ └── index.xml ├── static │ ├── favicon.png │ └── images │ │ ├── mir-arc.png │ │ ├── mir-logo.png │ │ └── logo-origin.jpeg ├── archetypes │ └── default.md └── resources │ └── _gen │ └── assets │ └── scss │ └── book.scss_e129fe35b8d0a70789c8a08429469073.json ├── internal ├── generator │ ├── templates │ │ └── README.md │ └── generator_test.go ├── naming │ └── naming.go └── internal_test.go ├── examples ├── sail-example │ ├── scripts │ │ ├── migration │ │ │ ├── postgres │ │ │ │ ├── 0007_content_type_alter.down.sql │ │ │ │ ├── 0005_topic_follow.down.sql │ │ │ │ ├── 0009_user_following.down.sql │ │ │ │ ├── 0004_share_count.down.sql │ │ │ │ ├── 0011_comment_essence.down.sql │ │ │ │ ├── 0013_user_relation_view.down.sql │ │ │ │ ├── 0002_post_visibility.down.sql │ │ │ │ ├── 0004_share_count.up.sql │ │ │ │ ├── 0011_comment_essence.up.sql │ │ │ │ ├── 0003_feature_contact.down.sql │ │ │ │ ├── 0002_post_visibility.up.sql │ │ │ │ ├── 0014_topic_user_pin.down.sql │ │ │ │ ├── 0008_create_view_post_filter.down.sql │ │ │ │ ├── 0012_rank_metrics.down.sql │ │ │ │ ├── 0014_topic_user_pin.up.sql │ │ │ │ ├── 0013_user_relation_view.up.sql │ │ │ │ ├── 0006_comment_thumbs.down.sql │ │ │ │ ├── 0010_home_timeline.down.sql │ │ │ │ ├── 0009_user_following.up.sql │ │ │ │ ├── 0007_content_type_alter.up.sql │ │ │ │ ├── 0001_initialize_schema.down.sql │ │ │ │ └── 0005_topic_follow.up.sql │ │ │ ├── sqlite3 │ │ │ │ ├── 0008_content_type_alter.down.sql │ │ │ │ ├── 0006_topic_follow.down.sql │ │ │ │ ├── 0010_user_following.down.sql │ │ │ │ ├── 0014_user_relation_view.down.sql │ │ │ │ ├── 0002_post_visibility.down.sql │ │ │ │ ├── 0005_share_count.down.sql │ │ │ │ ├── 0012_comment_essence.down.sql │ │ │ │ ├── 0005_share_count.up.sql │ │ │ │ ├── 0012_comment_essence.up.sql │ │ │ │ ├── 0015_topic_user_pin.down.sql │ │ │ │ ├── 0009_create_view_post_filter.down.sql │ │ │ │ ├── 0013_rank_metrics.down.sql │ │ │ │ ├── 0003_feature_contact.down.sql │ │ │ │ ├── 0002_post_visibility.up.sql │ │ │ │ ├── 0015_topic_user_pin.up.sql │ │ │ │ ├── 0014_user_relation_view.up.sql │ │ │ │ ├── 0007_comment_thumbs.down.sql │ │ │ │ ├── 0011_home_timeline.down.sql │ │ │ │ ├── 0010_user_following.up.sql │ │ │ │ ├── 0001_initialize_schema.down.sql │ │ │ │ └── 0006_topic_follow.up.sql │ │ │ ├── mysql │ │ │ │ ├── 0006_topic_follow.down.sql │ │ │ │ ├── 0010_user_following.down.sql │ │ │ │ ├── 0005_share_count.down.sql │ │ │ │ ├── 0014_user_relation_view.down.sql │ │ │ │ ├── 0002_post_visibility.down.sql │ │ │ │ ├── 0012_comment_essence.down.sql │ │ │ │ ├── 0005_share_count.up.sql │ │ │ │ ├── 0003_feature_contact.down.sql │ │ │ │ ├── 0009_create_view_post_filter.down.sql │ │ │ │ ├── 0012_comment_essence.up.sql │ │ │ │ ├── 0015_topic_user_pin.down.sql │ │ │ │ ├── 0013_rank_metrics.down.sql │ │ │ │ ├── 0002_post_visibility.up.sql │ │ │ │ ├── 0015_topic_user_pin.up.sql │ │ │ │ ├── 0014_user_relation_view.up.sql │ │ │ │ ├── 0007_comment_thumbs.down.sql │ │ │ │ ├── 0011_home_timeline.down.sql │ │ │ │ ├── 0008_content_type_alter.down.sql │ │ │ │ ├── 0008_content_type_alter.up.sql │ │ │ │ ├── 0010_user_following.up.sql │ │ │ │ └── 0001_initialize_schema.down.sql │ │ │ └── embed.go │ │ ├── README │ │ └── docker │ │ │ ├── Dockerfile.backend-runner │ │ │ ├── Dockerfile.backend-builder │ │ │ └── README.md │ ├── docs │ │ ├── README.md │ │ └── openapi │ │ │ ├── embed.go │ │ │ └── index.html │ ├── mirc │ │ ├── bot │ │ │ └── README.md │ │ └── gen.go │ ├── README.md │ ├── internal │ │ ├── conf │ │ │ └── mir.go │ │ ├── internal.go │ │ ├── dao │ │ │ └── dao.go │ │ ├── core │ │ │ └── core.go │ │ └── servants │ │ │ ├── docs │ │ │ ├── docs.go │ │ │ └── docs_embed.go │ │ │ ├── bot │ │ │ ├── bot.go │ │ │ └── user.go │ │ │ └── web │ │ │ ├── site.go │ │ │ ├── site_b.go │ │ │ ├── site_c.go │ │ │ ├── admin_a.go │ │ │ └── site_a.go │ ├── pkg │ │ ├── utils │ │ │ ├── utils.go │ │ │ └── str.go │ │ ├── debug │ │ │ ├── errors.go │ │ │ └── annotation.go │ │ ├── xerror │ │ │ └── common.go │ │ └── types │ │ │ └── types.go │ ├── config.yaml │ ├── main.go │ ├── .gitignore │ ├── cmd │ │ ├── version.go │ │ └── migrate │ │ │ └── migrate.go │ └── Dockerfile ├── mir-example │ ├── README.md │ ├── servants │ │ ├── site.go │ │ ├── site_b.go │ │ ├── site_c.go │ │ ├── admin_a.go │ │ └── site_a.go │ ├── Makefile │ ├── .gitignore │ ├── main.go │ └── mirc │ │ └── gen.go └── README.md ├── .gitattributes ├── mirc ├── build │ └── go2tmpl.sh ├── .gitignore ├── templates │ ├── chi │ │ ├── README.md.tmpl │ │ ├── servants │ │ │ ├── site.go.tmpl │ │ │ ├── site_b.go.tmpl │ │ │ ├── site_c.go.tmpl │ │ │ ├── site_a.go.tmpl │ │ │ ├── servants.go.tmpl │ │ │ └── core.go.tmpl │ │ ├── main.go.tmpl │ │ ├── go.mod.tmpl │ │ ├── .gitignore.tmpl │ │ ├── Makefile.tmpl │ │ └── mirc │ │ │ └── gen.go.tmpl │ ├── echo │ │ ├── README.md.tmpl │ │ ├── servants │ │ │ ├── site.go.tmpl │ │ │ ├── site_a.go.tmpl │ │ │ ├── site_b.go.tmpl │ │ │ ├── servants.go.tmpl │ │ │ └── core.go.tmpl │ │ ├── main.go.tmpl │ │ ├── .gitignore.tmpl │ │ ├── Makefile.tmpl │ │ └── mirc │ │ │ └── gen.go.tmpl │ ├── gin │ │ ├── README.md.tmpl │ │ ├── servants │ │ │ ├── site.go.tmpl │ │ │ ├── site_b.go.tmpl │ │ │ ├── admin_a.go.tmpl │ │ │ ├── site_c.go.tmpl │ │ │ ├── site_a.go.tmpl │ │ │ ├── servants.go.tmpl │ │ │ └── core.go.tmpl │ │ ├── main.go.tmpl │ │ ├── .gitignore.tmpl │ │ ├── Makefile.tmpl │ │ └── mirc │ │ │ └── gen.go.tmpl │ ├── iris │ │ ├── README.md.tmpl │ │ ├── servants │ │ │ ├── site.go.tmpl │ │ │ ├── site_a.go.tmpl │ │ │ ├── site_b.go.tmpl │ │ │ └── servants.go.tmpl │ │ ├── main.go.tmpl │ │ ├── .gitignore.tmpl │ │ ├── Makefile.tmpl │ │ └── mirc │ │ │ └── gen.go.tmpl │ ├── mux │ │ ├── README.md.tmpl │ │ ├── servants │ │ │ ├── site.go.tmpl │ │ │ ├── site_a.go.tmpl │ │ │ ├── site_b.go.tmpl │ │ │ ├── servants.go.tmpl │ │ │ └── core.go.tmpl │ │ ├── main.go.tmpl │ │ ├── go.mod.tmpl │ │ ├── .gitignore.tmpl │ │ ├── Makefile.tmpl │ │ └── mirc │ │ │ └── gen.go.tmpl │ ├── fiber │ │ ├── README.md.tmpl │ │ ├── servants │ │ │ ├── site.go.tmpl │ │ │ ├── site_a.go.tmpl │ │ │ ├── site_b.go.tmpl │ │ │ ├── servants.go.tmpl │ │ │ └── core.go.tmpl │ │ ├── main.go.tmpl │ │ ├── .gitignore.tmpl │ │ ├── Makefile.tmpl │ │ └── mirc │ │ │ └── gen.go.tmpl │ ├── hertz │ │ ├── README.md.tmpl │ │ ├── servants │ │ │ ├── site.go.tmpl │ │ │ ├── admin_a.go.tmpl │ │ │ ├── site_b.go.tmpl │ │ │ ├── site_c.go.tmpl │ │ │ ├── site_a.go.tmpl │ │ │ ├── servants.go.tmpl │ │ │ └── core.go.tmpl │ │ ├── main.go.tmpl │ │ ├── .gitignore.tmpl │ │ ├── Makefile.tmpl │ │ └── mirc │ │ │ └── gen.go.tmpl │ ├── macaron │ │ ├── README.md.tmpl │ │ ├── servants │ │ │ ├── site.go.tmpl │ │ │ ├── site_a.go.tmpl │ │ │ ├── site_b.go.tmpl │ │ │ └── servants.go.tmpl │ │ ├── main.go.tmpl │ │ ├── .gitignore.tmpl │ │ ├── Makefile.tmpl │ │ └── mirc │ │ │ └── gen.go.tmpl │ └── httprouter │ │ ├── README.md.tmpl │ │ ├── servants │ │ ├── site.go.tmpl │ │ ├── site_a.go.tmpl │ │ ├── site_b.go.tmpl │ │ ├── site_c.go.tmpl │ │ └── servants.go.tmpl │ │ ├── main.go.tmpl │ │ ├── go.mod.tmpl │ │ ├── .gitignore.tmpl │ │ ├── Makefile.tmpl │ │ └── mirc │ │ └── gen.go.tmpl ├── go.mod └── main.go ├── go.mod ├── engine ├── internal │ ├── internal.go │ └── help.go └── engine_test.go ├── service ├── runtime.go ├── help.go └── http_server.go ├── .gitignore ├── .golangci.yml ├── .github └── dependabot.yml ├── go.sum └── Makefile /docs/.gitignore: -------------------------------------------------------------------------------- 1 | .hugo_build.lock -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/inject/body.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/inject/footer.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/inject/head.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/content.en/menu/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | headless: false 3 | --- 4 | -------------------------------------------------------------------------------- /docs/content.zh/menu/index.md: -------------------------------------------------------------------------------- 1 | --- 2 | headless: false 3 | --- 4 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/inject/menu-after.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/inject/menu-before.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/inject/toc-after.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/inject/toc-before.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/inject/content-after.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/inject/content-before.html: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/assets/_variables.scss: -------------------------------------------------------------------------------- 1 | /* You can override SASS variables here. */ 2 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/_default/list.html: -------------------------------------------------------------------------------- 1 | {{ define "dummy" }}{{ end }} 2 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/alex-shpak/hugo-book 2 | 3 | go 1.16 4 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/_default/single.html: -------------------------------------------------------------------------------- 1 | {{ define "dummy" }}{{ end }} 2 | -------------------------------------------------------------------------------- /docs/public/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/favicon.png -------------------------------------------------------------------------------- /docs/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/static/favicon.png -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/themes/_dark.scss: -------------------------------------------------------------------------------- 1 | :root { 2 | @include theme-dark; 3 | } 4 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/themes/_light.scss: -------------------------------------------------------------------------------- 1 | :root { 2 | @include theme-light; 3 | } 4 | -------------------------------------------------------------------------------- /internal/generator/templates/README.md: -------------------------------------------------------------------------------- 1 | # templates 2 | use for generate interface's template. -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0007_content_type_alter.down.sql: -------------------------------------------------------------------------------- 1 | -- nothing 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0008_content_type_alter.down.sql: -------------------------------------------------------------------------------- 1 | -- nothing 2 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/.gitignore: -------------------------------------------------------------------------------- 1 | public/ 2 | exampleSite/public/ 3 | .DS_Store 4 | .hugo_build.lock 5 | -------------------------------------------------------------------------------- /docs/public/images/mir-arc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/images/mir-arc.png -------------------------------------------------------------------------------- /docs/public/images/mir-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/images/mir-logo.png -------------------------------------------------------------------------------- /docs/static/images/mir-arc.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/static/images/mir-arc.png -------------------------------------------------------------------------------- /docs/static/images/mir-logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/static/images/mir-logo.png -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/assets/_variables.scss: -------------------------------------------------------------------------------- 1 | /* You can override SASS variables here. */ 2 | -------------------------------------------------------------------------------- /examples/sail-example/docs/README.md: -------------------------------------------------------------------------------- 1 | ## 开发文档 2 | 本目录包含一些开发者文档。 3 | 4 | * [openapi](openapi): api相关文档 5 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0006_topic_follow.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `p_topic_user`; -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/content.en/docs/shortcodes/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookFlatSection: true 3 | --- 4 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0005_topic_follow.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS p_topic_user; -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0006_topic_follow.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `p_topic_user`; -------------------------------------------------------------------------------- /docs/content.zh/docs/tutorials/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 2 3 | bookFlatSection: true 4 | title: "使用指南" 5 | --- 6 | -------------------------------------------------------------------------------- /docs/public/images/logo-origin.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/images/logo-origin.jpeg -------------------------------------------------------------------------------- /docs/static/images/logo-origin.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/static/images/logo-origin.jpeg -------------------------------------------------------------------------------- /docs/themes/hugo-book/images/tn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/images/tn.png -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/html-head-title.html: -------------------------------------------------------------------------------- 1 | {{ partial "docs/title" . }} | {{ .Site.Title -}} 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0010_user_following.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `p_following`; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0009_user_following.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS p_following; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0010_user_following.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS "p_following"; 2 | -------------------------------------------------------------------------------- /docs/content.en/docs/tutorials/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 2 3 | bookFlatSection: true 4 | title: "Turotials" 5 | --- 6 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/_custom.scss: -------------------------------------------------------------------------------- 1 | /* You can add custom styles here. */ 2 | 3 | // @import "plugins/numbered"; 4 | -------------------------------------------------------------------------------- /examples/sail-example/mirc/bot/README.md: -------------------------------------------------------------------------------- 1 | ### Bot系列RESTful API相关定义文件 2 | 本目录包含 Bot相关API定义文件。 3 | 4 | * v1 - v1版本API 5 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0005_share_count.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post` DROP COLUMN `share_count`; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0014_user_relation_view.down.sql: -------------------------------------------------------------------------------- 1 | DROP VIEW IF EXISTS p_user_relation; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0004_share_count.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_post DROP COLUMN share_count; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0011_comment_essence.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_comment DROP COLUMN is_essence; -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0013_user_relation_view.down.sql: -------------------------------------------------------------------------------- 1 | DROP VIEW IF EXISTS p_user_relation; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0014_user_relation_view.down.sql: -------------------------------------------------------------------------------- 1 | DROP VIEW IF EXISTS p_user_relation; 2 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/_variables.scss: -------------------------------------------------------------------------------- 1 | /* You can override SASS variables here. */ 2 | 3 | // @import "plugins/dark"; 4 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/favicon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/favicon.png -------------------------------------------------------------------------------- /examples/sail-example/scripts/README: -------------------------------------------------------------------------------- 1 | All files in subdirectories are templates, do modifications based on your environment first. -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0002_post_visibility.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post` DROP COLUMN `visibility`; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0012_comment_essence.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_comment` DROP COLUMN `is_essence`; -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0002_post_visibility.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_post DROP COLUMN visibility; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0002_post_visibility.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post` DROP COLUMN `visibility`; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0005_share_count.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post` DROP COLUMN `share_count`; 2 | -------------------------------------------------------------------------------- /docs/public/fonts/roboto-v27-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/fonts/roboto-v27-latin-700.woff -------------------------------------------------------------------------------- /docs/public/fonts/roboto-v27-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/fonts/roboto-v27-latin-700.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-Bold.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-Bold.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/images/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/images/screenshot.png -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0012_comment_essence.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "p_comment" DROP COLUMN "is_essence"; 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.js linguist-language=go 2 | *.css linguist-language=go 3 | *.scss linguist-language=go 4 | *.html linguist-language=go -------------------------------------------------------------------------------- /docs/archetypes/default.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ replace .Name "-" " " | title }}" 3 | date: {{ .Date }} 4 | draft: true 5 | --- 6 | 7 | -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_AMS-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_AMS-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_AMS-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_AMS-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Fraktur-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Fraktur-Bold.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-Bold.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-Italic.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-Italic.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Math-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Math-Italic.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Math-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Math-Italic.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/mermaid.json: -------------------------------------------------------------------------------- 1 | { 2 | "flowchart": { 3 | "useMaxWidth":true 4 | }, 5 | "theme": "default" 6 | } 7 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/content.en/docs/example/collapsed/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | weight: 20 4 | --- 5 | -------------------------------------------------------------------------------- /docs/assets/_custom.scss: -------------------------------------------------------------------------------- 1 | /* You can add custom styles here. */ 2 | 3 | // @import "plugins/numbered"; 4 | // @import "plugins/scrollbars"; 5 | -------------------------------------------------------------------------------- /docs/public/fonts/roboto-v27-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/fonts/roboto-v27-latin-regular.woff -------------------------------------------------------------------------------- /docs/public/fonts/roboto-v27-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/fonts/roboto-v27-latin-regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_AMS-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_AMS-Regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Fraktur-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Fraktur-Bold.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Fraktur-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Fraktur-Bold.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Fraktur-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Fraktur-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-BoldItalic.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-Italic.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-Regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Math-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Math-BoldItalic.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Math-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Math-Italic.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_SansSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_SansSerif-Bold.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_SansSerif-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_SansSerif-Bold.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Script-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Script-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Script-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Script-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size1-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size1-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size1-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size1-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size1-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size1-Regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size2-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size2-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size2-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size2-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size2-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size2-Regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size3-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size3-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size3-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size3-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size3-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size3-Regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size4-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size4-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size4-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size4-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Size4-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Size4-Regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Caligraphic-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Caligraphic-Bold.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Caligraphic-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Caligraphic-Bold.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Fraktur-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Fraktur-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Fraktur-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Fraktur-Regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-BoldItalic.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Main-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Main-BoldItalic.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Math-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Math-BoldItalic.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Math-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Math-BoldItalic.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_SansSerif-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_SansSerif-Bold.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_SansSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_SansSerif-Italic.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_SansSerif-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_SansSerif-Italic.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_SansSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_SansSerif-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Script-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Script-Regular.woff2 -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0005_share_count.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post` ADD COLUMN `share_count` integer NOT NULL DEFAULT 0; -------------------------------------------------------------------------------- /docs/public/fonts/roboto-mono-v13-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/fonts/roboto-mono-v13-latin-regular.woff -------------------------------------------------------------------------------- /docs/public/fonts/roboto-mono-v13-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/fonts/roboto-mono-v13-latin-regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Caligraphic-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Caligraphic-Bold.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Caligraphic-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Caligraphic-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Caligraphic-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Caligraphic-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_SansSerif-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_SansSerif-Italic.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_SansSerif-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_SansSerif-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_SansSerif-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_SansSerif-Regular.woff2 -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Typewriter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Typewriter-Regular.ttf -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Typewriter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Typewriter-Regular.woff -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Typewriter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Typewriter-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/content.en/posts/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | menu: 3 | after: 4 | name: blog 5 | weight: 5 6 | title: Blog 7 | --- 8 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0005_share_count.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post` ADD COLUMN `share_count` BIGINT unsigned NOT NULL DEFAULT 0; -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0004_share_count.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_post ADD COLUMN share_count BIGINT NOT NULL DEFAULT 0; -- 分享数 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0011_comment_essence.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_comment ADD COLUMN is_essence SMALLINT NOT NULL DEFAULT 0; 2 | -------------------------------------------------------------------------------- /docs/public/katex/fonts/KaTeX_Caligraphic-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/public/katex/fonts/KaTeX_Caligraphic-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/hint.html: -------------------------------------------------------------------------------- 1 |
2 | {{ .Inner | .Page.RenderString }} 3 |
4 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0003_feature_contact.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `p_contact`; 2 | DROP TABLE IF EXISTS `p_contact_group`; 3 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0003_feature_contact.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS p_contact; 2 | DROP TABLE IF EXISTS p_contact_group; 3 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0012_comment_essence.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "p_comment" ADD COLUMN "is_essence" integer NOT NULL DEFAULT 0; 2 | -------------------------------------------------------------------------------- /mirc/build/go2tmpl.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | GOFILES=$(find . -type f) 4 | 5 | for filename in $GOFILES 6 | do 7 | mv ${filename} ${filename}.tmpl 8 | done -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/toc.html: -------------------------------------------------------------------------------- 1 | {{ partial "docs/inject/toc-before" . }} 2 | {{ .TableOfContents }} 3 | {{ partial "docs/inject/toc-after" . }} 4 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/fonts/roboto-v27-latin-700.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/fonts/roboto-v27-latin-700.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/fonts/roboto-v27-latin-700.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/fonts/roboto-v27-latin-700.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Bold.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Bold.woff -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0009_create_view_post_filter.down.sql: -------------------------------------------------------------------------------- 1 | DROP VIEW IF EXISTS p_post_by_media; 2 | DROP VIEW IF EXISTS p_post_by_comment; 3 | -------------------------------------------------------------------------------- /docs/public/sw.min.cc53640256a4c5a819e5408f192a460fbdab1162f59e2640475ed9eaeba2a25b.js: -------------------------------------------------------------------------------- 1 | navigator.serviceWorker&&navigator.serviceWorker.register("/mir/sw.js",{scope:"/"}) -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/assets/_custom.scss: -------------------------------------------------------------------------------- 1 | /* You can add custom styles here. */ 2 | 3 | // @import "plugins/numbered"; 4 | // @import "plugins/scrollbars"; 5 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/fonts/roboto-v27-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/fonts/roboto-v27-latin-regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_AMS-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_AMS-Regular.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_AMS-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_AMS-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_AMS-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_AMS-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Bold.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Bold.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Bold.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Italic.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Italic.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Italic.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Regular.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-Italic.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-Italic.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-Italic.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size1-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size1-Regular.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size2-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size2-Regular.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size3-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size3-Regular.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size4-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size4-Regular.ttf -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0002_post_visibility.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_post ADD COLUMN visibility SMALLINT NOT NULL DEFAULT 0; -- 可见性 0公开 1私密 2好友可见 2 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/fonts/roboto-v27-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/fonts/roboto-v27-latin-regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Bold.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Regular.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-BoldItalic.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-BoldItalic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-BoldItalic.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Bold.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Bold.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Script-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Script-Regular.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Script-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Script-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size1-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size1-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size1-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size1-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size2-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size2-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size2-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size2-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size3-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size3-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size3-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size3-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size4-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size4-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Size4-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Size4-Regular.woff2 -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0012_comment_essence.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_comment` ADD COLUMN `is_essence` tinyint unsigned NOT NULL DEFAULT 0 COMMENT '是否精选'; 2 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0014_topic_user_pin.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_topic_user DROP COLUMN is_pin; 2 | DROP INDEX IF EXISTS idx_topic_user_uid_ispin; 3 | -------------------------------------------------------------------------------- /mirc/.gitignore: -------------------------------------------------------------------------------- 1 | /mirc 2 | /gin 3 | /hertz 4 | /chi 5 | /chi-v5 6 | /mux 7 | /httprouter 8 | /macaron 9 | /echo 10 | /iris 11 | /fiber 12 | /fiber-v2 13 | /release/* 14 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/archetypes/posts.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ .Name | humanize | title }}" 3 | date: {{ .Date }} 4 | # bookComments: false 5 | # bookSearchExclude: false 6 | --- 7 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/comments.html: -------------------------------------------------------------------------------- 1 | 2 | {{ template "_internal/disqus.html" . }} 3 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/fonts/roboto-mono-v13-latin-regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/fonts/roboto-mono-v13-latin-regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Bold.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Bold.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Bold.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Bold.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Bold.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Fraktur-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-BoldItalic.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Main-BoldItalic.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-BoldItalic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-BoldItalic.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-BoldItalic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Math-BoldItalic.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Bold.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Bold.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Italic.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Italic.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Italic.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Italic.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Italic.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Italic.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Regular.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Script-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Script-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Typewriter-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Typewriter-Regular.ttf -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0015_topic_user_pin.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_topic_user` DROP COLUMN `is_pin`; 2 | DROP INDEX IF EXISTS `idx_topic_user_uid_ispin`; 3 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0015_topic_user_pin.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "p_topic_user" DROP COLUMN "is_pin"; 2 | DROP INDEX IF EXISTS "idx_topic_user_uid_ispin"; 3 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/fonts/roboto-mono-v13-latin-regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/fonts/roboto-mono-v13-latin-regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Regular.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Regular.ttf -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_SansSerif-Regular.woff2 -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Typewriter-Regular.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Typewriter-Regular.woff -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Typewriter-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Typewriter-Regular.woff2 -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0008_create_view_post_filter.down.sql: -------------------------------------------------------------------------------- 1 | DROP VIEW IF EXISTS p_post_by_media; 2 | DROP VIEW IF EXISTS p_post_by_comment; 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0009_create_view_post_filter.down.sql: -------------------------------------------------------------------------------- 1 | DROP VIEW IF EXISTS p_post_by_media; 2 | DROP VIEW IF EXISTS p_post_by_comment; 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Regular.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/alimy/mir/HEAD/docs/themes/hugo-book/static/katex/fonts/KaTeX_Caligraphic-Regular.woff2 -------------------------------------------------------------------------------- /examples/mir-example/README.md: -------------------------------------------------------------------------------- 1 | ## mir-example 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make run 8 | ``` 9 | -------------------------------------------------------------------------------- /docs/public/favicon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/themes/_auto.scss: -------------------------------------------------------------------------------- 1 | :root { 2 | @include theme-light; 3 | } 4 | 5 | @media (prefers-color-scheme: dark) { 6 | :root { 7 | @include theme-dark; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /examples/sail-example/README.md: -------------------------------------------------------------------------------- 1 | ## sail-example 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make serve 8 | ``` 9 | -------------------------------------------------------------------------------- /mirc/templates/chi/README.md.tmpl: -------------------------------------------------------------------------------- 1 | ## mir-examples 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make build 8 | ``` 9 | -------------------------------------------------------------------------------- /mirc/templates/echo/README.md.tmpl: -------------------------------------------------------------------------------- 1 | ## mir-examples 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make build 8 | ``` 9 | -------------------------------------------------------------------------------- /mirc/templates/gin/README.md.tmpl: -------------------------------------------------------------------------------- 1 | ## mir-examples 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make build 8 | ``` 9 | -------------------------------------------------------------------------------- /mirc/templates/iris/README.md.tmpl: -------------------------------------------------------------------------------- 1 | ## mir-examples 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make build 8 | ``` 9 | -------------------------------------------------------------------------------- /mirc/templates/mux/README.md.tmpl: -------------------------------------------------------------------------------- 1 | ## mir-examples 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make build 8 | ``` 9 | -------------------------------------------------------------------------------- /docs/public/svg/menu.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mirc/templates/fiber/README.md.tmpl: -------------------------------------------------------------------------------- 1 | ## mir-examples 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make build 8 | ``` 9 | -------------------------------------------------------------------------------- /mirc/templates/hertz/README.md.tmpl: -------------------------------------------------------------------------------- 1 | ## mir-examples 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make build 8 | ``` 9 | -------------------------------------------------------------------------------- /mirc/templates/macaron/README.md.tmpl: -------------------------------------------------------------------------------- 1 | ## mir-examples 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make build 8 | ``` 9 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0013_rank_metrics.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_comment` DROP COLUMN `reply_count`; 2 | DROP TABLE IF EXISTS `p_comment_metric`; 3 | DROP TABLE IF EXISTS `p_user_metric`; 4 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0013_rank_metrics.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "p_comment" DROP COLUMN "reply_count"; 2 | DROP TABLE IF EXISTS "p_comment_metric"; 3 | DROP TABLE IF EXISTS "p_user_metric"; 4 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/README.md.tmpl: -------------------------------------------------------------------------------- 1 | ## mir-examples 2 | just a simple mir's examples for explain how to use mir in your project. 3 | 4 | #### Usage 5 | ```bash 6 | % make generate 7 | % make build 8 | ``` 9 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0012_rank_metrics.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_comment DROP COLUMN IF EXISTS reply_count; 2 | DROP TABLE IF EXISTS p_comment_metric; 3 | DROP TABLE IF EXISTS p_user_metric; 4 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/_default/_markup/render-heading.html: -------------------------------------------------------------------------------- 1 | 2 | {{ .Text | safeHTML }} 3 | # 4 | 5 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/favicon.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/svg/menu.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/docker/Dockerfile.backend-runner: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM alpine:3.18 3 | ENV TZ=Asia/Shanghai 4 | RUN apk update && apk add --no-cache ca-certificates && update-ca-certificates 5 | -------------------------------------------------------------------------------- /go.mod: -------------------------------------------------------------------------------- 1 | module github.com/alimy/mir/v5 2 | 3 | go 1.24.0 4 | 5 | require golang.org/x/tools v0.36.0 6 | 7 | require ( 8 | golang.org/x/mod v0.27.0 // indirect 9 | golang.org/x/sync v0.16.0 // indirect 10 | ) 11 | -------------------------------------------------------------------------------- /examples/sail-example/internal/conf/mir.go: -------------------------------------------------------------------------------- 1 | package conf 2 | 3 | import ( 4 | "github.com/alimy/mir/v5/service" 5 | "github.com/fatih/color" 6 | ) 7 | 8 | func setupMir() { 9 | service.SetOutput(color.Output) 10 | } 11 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/docker/Dockerfile.backend-builder: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | FROM golang:1.21-alpine3.18 3 | RUN apk --no-cache --no-progress add --virtual \ 4 | build-deps \ 5 | build-base \ 6 | git 7 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0003_feature_contact.down.sql: -------------------------------------------------------------------------------- 1 | PRAGMA foreign_keys = false; 2 | 3 | DROP TABLE IF EXISTS "p_contact"; 4 | DROP TABLE IF EXISTS "p_contact_group"; 5 | 6 | PRAGMA foreign_keys = true; 7 | -------------------------------------------------------------------------------- /examples/sail-example/pkg/utils/utils.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package utils 6 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0002_post_visibility.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post` ADD COLUMN `visibility` integer NOT NULL DEFAULT '0'; 2 | 3 | CREATE INDEX "main"."idx_visibility" 4 | ON "p_post" ( 5 | "visibility" ASC 6 | ); 7 | -------------------------------------------------------------------------------- /docs/public/svg/toc.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/sail-example/internal/internal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package internal 6 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/columns.html: -------------------------------------------------------------------------------- 1 |
2 | {{ range split .Inner "<--->" }} 3 |
4 | {{ . | $.Page.RenderString }} 5 |
6 | {{ end }} 7 |
8 | -------------------------------------------------------------------------------- /docs/resources/_gen/assets/scss/book.scss_e129fe35b8d0a70789c8a08429469073.json: -------------------------------------------------------------------------------- 1 | {"Target":"book.min.33a48f5432973b8ff9a82679d9e45d67f2c15d4399bd2829269455cfe390b5e8.css","MediaType":"text/css","Data":{"Integrity":"sha256-M6SPVDKXO4/5qCZ52eRdZ/LBXUOZvSgpJpRVz+OQteg="}} -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/svg/toc.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0002_post_visibility.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post` ADD COLUMN `visibility` tinyint unsigned NOT NULL DEFAULT '0' COMMENT '可见性 0公开 1私密 2好友可见'; 2 | CREATE INDEX `idx_visibility` ON `p_post` ( `visibility` ) USING BTREE; 3 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0014_topic_user_pin.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_topic_user ADD COLUMN is_pin SMALLINT NOT NULL DEFAULT 0; -- 是否钉住 0 为未钉住、1 为已钉住 2 | CREATE INDEX idx_topic_user_uid_ispin ON p_topic_user USING btree ( user_id, is_pin ); 3 | -------------------------------------------------------------------------------- /docs/public/svg/calendar.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /examples/README.md: -------------------------------------------------------------------------------- 1 | ## Examples 2 | Some example for mir. 3 | 4 | - [mir-example](mir-example) - simple minimal mir example for explain how to use mir. 5 | - [sail-example](sail-example) - product least mir example for explain how to use mir in production enviroment. 6 | 7 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0015_topic_user_pin.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_topic_user` ADD COLUMN `is_pin` TINYINT NOT NULL DEFAULT 0 COMMENT '是否钉住 0 为未钉住、1 为已钉住'; 2 | CREATE INDEX `idx_topic_user_uid_ispin` ON `p_topic_user` (`user_id`, `is_pin`) USING BTREE; 3 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0015_topic_user_pin.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "p_topic_user" ADD COLUMN "is_pin" integer NOT NULL DEFAULT 0; 2 | CREATE INDEX "main"."idx_topic_user_uid_ispin" 3 | ON "p_topic_user" ( 4 | "user_id" ASC, 5 | "is_pin" ASC 6 | ); 7 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/archetypes/docs.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "{{ .Name | humanize | title }}" 3 | weight: 1 4 | # bookFlatSection: false 5 | # bookToc: true 6 | # bookHidden: false 7 | # bookCollapseSection: false 8 | # bookComments: false 9 | # bookSearchExclude: false 10 | --- 11 | -------------------------------------------------------------------------------- /mirc/templates/chi/servants/site.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "{{ .PkgName }}/mirc/auto/api" 5 | ) 6 | 7 | type siteSrv struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrv() api.Site { 13 | return &siteSrv{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/echo/servants/site.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "{{ .PkgName }}/mirc/auto/api" 5 | ) 6 | 7 | type siteSrv struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrv() api.Site { 13 | return &siteSrv{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/gin/servants/site.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "{{ .PkgName }}/mirc/auto/api" 5 | ) 6 | 7 | type siteSrv struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrv() api.Site { 13 | return &siteSrv{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/iris/servants/site.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "{{ .PkgName }}/mirc/auto/api" 5 | ) 6 | 7 | type siteSrv struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrv() api.Site { 13 | return &siteSrv{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/mux/servants/site.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "{{ .PkgName }}/mirc/auto/api" 5 | ) 6 | 7 | type siteSrv struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrv() api.Site { 13 | return &siteSrv{} 14 | } 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/sw-register.js: -------------------------------------------------------------------------------- 1 | {{- $swJS := resources.Get "sw.js" | resources.ExecuteAsTemplate "sw.js" . -}} 2 | if (navigator.serviceWorker) { 3 | navigator.serviceWorker.register( 4 | "{{ $swJS.RelPermalink }}", 5 | { scope: "{{ "/" | relURL }}" } 6 | ); 7 | } 8 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/date.html: -------------------------------------------------------------------------------- 1 | 5 | {{- $format := default "January 2, 2006" .Format -}} 6 | {{- return (.Date.Format $format) -}} 7 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/svg/calendar.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /mirc/templates/fiber/servants/site.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "{{ .PkgName }}/mirc/auto/api" 5 | ) 6 | 7 | type siteSrv struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrv() api.Site { 13 | return &siteSrv{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/hertz/servants/site.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "{{ .PkgName }}/mirc/auto/api" 5 | ) 6 | 7 | type siteSrv struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrv() api.Site { 13 | return &siteSrv{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/macaron/servants/site.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "{{ .PkgName }}/mirc/auto/api" 5 | ) 6 | 7 | type siteSrv struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrv() api.Site { 13 | return &siteSrv{} 14 | } 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/resources/_gen/assets/scss/book.scss_e129fe35b8d0a70789c8a08429469073.json: -------------------------------------------------------------------------------- 1 | {"Target":"book.min.33a48f5432973b8ff9a82679d9e45d67f2c15d4399bd2829269455cfe390b5e8.css","MediaType":"text/css","Data":{"Integrity":"sha256-M6SPVDKXO4/5qCZ52eRdZ/LBXUOZvSgpJpRVz+OQteg="}} -------------------------------------------------------------------------------- /mirc/templates/httprouter/servants/site.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "{{ .PkgName }}/mirc/auto/api" 5 | ) 6 | 7 | type siteSrv struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrv() api.Site { 13 | return &siteSrv{} 14 | } 15 | -------------------------------------------------------------------------------- /docs/public/zh/index.html: -------------------------------------------------------------------------------- 1 | https://alimy.github.io/mir/ 2 | -------------------------------------------------------------------------------- /examples/sail-example/internal/dao/dao.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | // package dao contains some database logic 6 | 7 | package dao 8 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/docker/README.md: -------------------------------------------------------------------------------- 1 | ### Dockerfile builer pre-build images 2 | 3 | ```sh 4 | docker buildx build -t bitbus/paopao-ce-backend-builder:latest -f Dockerfile.backend-builder . 5 | docker buildx build -t bitbus/paopao-ce-backend-runner:latest -f Dockerfile.backend-runner . 6 | ``` -------------------------------------------------------------------------------- /mirc/templates/chi/servants/site_b.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v2" 5 | ) 6 | 7 | type siteSrvB struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvB() api.Site { 13 | return &siteSrvB{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/chi/servants/site_c.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v3" 5 | ) 6 | 7 | type siteSrvC struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvC() api.Site { 13 | return &siteSrvC{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/echo/servants/site_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type siteSrvA struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvA() api.Site { 13 | return &siteSrvA{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/echo/servants/site_b.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v2" 5 | ) 6 | 7 | type siteSrvB struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvB() api.Site { 13 | return &siteSrvB{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/fiber/servants/site_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type siteSrvA struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvA() api.Site { 13 | return &siteSrvA{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/fiber/servants/site_b.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v2" 5 | ) 6 | 7 | type siteSrvB struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvB() api.Site { 13 | return &siteSrvB{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/gin/servants/site_b.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v2" 5 | ) 6 | 7 | type siteSrvB struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvB() api.Site { 13 | return &siteSrvB{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/iris/servants/site_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type siteSrvA struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvA() api.Site { 13 | return &siteSrvA{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/iris/servants/site_b.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v2" 5 | ) 6 | 7 | type siteSrvB struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvB() api.Site { 13 | return &siteSrvB{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/macaron/servants/site_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type siteSrvA struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvA() api.Site { 13 | return &siteSrvA{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/macaron/servants/site_b.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v2" 5 | ) 6 | 7 | type siteSrvB struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvB() api.Site { 13 | return &siteSrvB{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/mux/servants/site_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type siteSrvA struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvA() api.Site { 13 | return &siteSrvA{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/mux/servants/site_b.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v2" 5 | ) 6 | 7 | type siteSrvB struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvB() api.Site { 13 | return &siteSrvB{} 14 | } 15 | -------------------------------------------------------------------------------- /examples/sail-example/internal/core/core.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | // package core contains application core logic 6 | 7 | package core 8 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0014_user_relation_view.up.sql: -------------------------------------------------------------------------------- 1 | CREATE VIEW p_user_relation AS 2 | SELECT user_id, friend_id he_uid, 5 AS style 3 | FROM p_contact WHERE status=2 AND is_del=0 4 | UNION 5 | SELECT user_id, follow_id he_uid, 10 AS style 6 | FROM p_following WHERE is_del=0; 7 | -------------------------------------------------------------------------------- /mirc/templates/gin/servants/admin_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type adminSrvA struct { 8 | baseSrv 9 | api.UnimplementedAdminServant 10 | } 11 | 12 | func newAdminSrvA() api.Admin { 13 | return &adminSrvA{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/gin/servants/site_c.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v3" 5 | ) 6 | 7 | type siteSrvC struct { 8 | baseSrv 9 | 10 | api.UnimplementedSiteServant 11 | } 12 | 13 | func newSiteSrvC() api.Site { 14 | return &siteSrvC{} 15 | } 16 | -------------------------------------------------------------------------------- /mirc/templates/hertz/servants/admin_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type adminSrvA struct { 8 | baseSrv 9 | api.UnimplementedAdminServant 10 | } 11 | 12 | func newAdminSrvA() api.Admin { 13 | return &adminSrvA{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/hertz/servants/site_b.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v2" 5 | ) 6 | 7 | type siteSrvB struct { 8 | baseSrv 9 | 10 | api.UnimplementedSiteServant 11 | } 12 | 13 | func newSiteSrvB() api.Site { 14 | return &siteSrvB{} 15 | } 16 | -------------------------------------------------------------------------------- /mirc/templates/hertz/servants/site_c.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v3" 5 | ) 6 | 7 | type siteSrvC struct { 8 | baseSrv 9 | 10 | api.UnimplementedSiteServant 11 | } 12 | 13 | func newSiteSrvC() api.Site { 14 | return &siteSrvC{} 15 | } 16 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/servants/site_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type siteSrvA struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvA() api.Site { 13 | return &siteSrvA{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/servants/site_b.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v2" 5 | ) 6 | 7 | type siteSrvB struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvB() api.Site { 13 | return &siteSrvB{} 14 | } 15 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/servants/site_c.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v3" 5 | ) 6 | 7 | type siteSrvC struct { 8 | baseSrv 9 | api.UnimplementedSiteServant 10 | } 11 | 12 | func newSiteSrvC() api.Site { 13 | return &siteSrvC{} 14 | } 15 | -------------------------------------------------------------------------------- /docs/content.zh/docs/recommends/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 3 3 | bookFlatSection: true 4 | title: "推荐项目" 5 | --- 6 | 7 | - [Yesql](https://alimy.github.io/yesql) - 🔥一个用于使用[sqlx](https://github.com/jmoiron/sqlx)来开发数据业务逻辑的辅助库. 8 | - [paopao-ce](https://github.com/rocboss/paopao-ce/tree/dev) - 🔥一个清新文艺的微社区. 9 | -------------------------------------------------------------------------------- /docs/public/svg/edit.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/section.html: -------------------------------------------------------------------------------- 1 |
2 | {{ range .Page.Pages }} 3 |
4 | {{ partial "docs/title" . }} 5 |
6 |
7 | {{ default .Summary .Description }} 8 |
9 | {{ end }} 10 |
11 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0013_user_relation_view.up.sql: -------------------------------------------------------------------------------- 1 | CREATE VIEW p_user_relation AS 2 | SELECT user_id, friend_id he_uid, 5 AS style 3 | FROM p_contact WHERE status=2 AND is_del=0 4 | UNION 5 | SELECT user_id, follow_id he_uid, 10 AS style 6 | FROM p_following WHERE is_del=0; 7 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0014_user_relation_view.up.sql: -------------------------------------------------------------------------------- 1 | CREATE VIEW p_user_relation AS 2 | SELECT user_id, friend_id he_uid, 5 AS style 3 | FROM p_contact WHERE status=2 AND is_del=0 4 | UNION 5 | SELECT user_id, follow_id he_uid, 10 AS style 6 | FROM p_following WHERE is_del=0; 7 | -------------------------------------------------------------------------------- /docs/public/tags/page/1/index.html: -------------------------------------------------------------------------------- 1 | https://alimy.github.io/mir/tags/ 2 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/svg/edit.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/am.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: ፈልግ 3 | 4 | - id: Edit this page 5 | translation: ይህንን ገጽ አስተካክል 6 | 7 | - id: Last modified by 8 | translation: መጨረሻ የከለሰው ሰው 9 | 10 | - id: Expand 11 | translation: አስፋ 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/menu-reset.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var menu = document.querySelector("aside .book-menu-content"); 3 | addEventListener("beforeunload", function(event) { 4 | localStorage.setItem("menu.scrollTop", menu.scrollTop); 5 | }); 6 | menu.scrollTop = localStorage.getItem("menu.scrollTop"); 7 | })(); 8 | -------------------------------------------------------------------------------- /mirc/templates/macaron/main.go.tmpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "gopkg.in/macaron.v1" 5 | "{{ .PkgName }}/servants" 6 | ) 7 | 8 | func main() { 9 | m := macaron.New() 10 | 11 | // register servants to macaron 12 | servants.RegisterServants(m) 13 | 14 | // start servant service(:4000) 15 | m.Run() 16 | } 17 | -------------------------------------------------------------------------------- /docs/public/en/tags/page/1/index.html: -------------------------------------------------------------------------------- 1 | https://alimy.github.io/mir/en/tags/ 2 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/content.en/docs/shortcodes/section/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | bookCollapseSection: true 3 | --- 4 | 5 | # Section 6 | 7 | Section renders pages in section as definition list, using title and description. 8 | 9 | ## Example 10 | 11 | ```tpl 12 | {{}} 13 | ``` 14 | 15 | {{
}} 16 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/en.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Search 3 | 4 | - id: Edit this page 5 | translation: Edit this page 6 | 7 | - id: Last modified by 8 | translation: Last modified by 9 | 10 | - id: Expand 11 | translation: Expand 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/nb.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Søk 3 | 4 | - id: Edit this page 5 | translation: Rediger denne siden 6 | 7 | - id: Last modified by 8 | translation: Sist endret av 9 | 10 | - id: Expand 11 | translation: Utvid 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/menu-bundle.html: -------------------------------------------------------------------------------- 1 | {{ with .Site.GetPage .Site.Params.BookMenuBundle }} 2 | {{- $href := printf "href=\"%s\"" $.RelPermalink -}} 3 | {{- replace .Content $href (print $href "class=active") | safeHTML -}} 4 | {{- warnf "Bundle menu mode is deprecated and will be removed" -}} 5 | {{ end }} 6 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/pt.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Buscar 3 | 4 | - id: Edit this page 5 | translation: Editar página 6 | 7 | - id: Last modified by 8 | translation: Última modificação por 9 | 10 | - id: Expand 11 | translation: Expandir 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/tr.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Arama 3 | 4 | - id: Edit this page 5 | translation: Bu sayfayı düzenle 6 | 7 | - id: Last modified by 8 | translation: Son düzenleyen 9 | 10 | - id: Expand 11 | translation: Genişlet 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/public/categories/page/1/index.html: -------------------------------------------------------------------------------- 1 | https://alimy.github.io/mir/categories/ 2 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/de.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Suche 3 | 4 | - id: Edit this page 5 | translation: Seite bearbeiten 6 | 7 | - id: Last modified by 8 | translation: Zuletzt geändert von 9 | 10 | - id: Expand 11 | translation: Erweitern 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/es.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Buscar 3 | 4 | - id: Edit this page 5 | translation: Editar esta página 6 | 7 | - id: Last modified by 8 | translation: Última modificación por 9 | 10 | - id: Expand 11 | translation: Expand 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/it.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Cerca 3 | 4 | - id: Edit this page 5 | translation: Modifica questa pagina 6 | 7 | - id: Last modified by 8 | translation: Ultima modifica di 9 | 10 | - id: Expand 11 | translation: Espandi 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/sv.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Sök 3 | 4 | - id: Edit this page 5 | translation: Redigera denna sida 6 | 7 | - id: Last modified by 8 | translation: Senast modifierad av 9 | 10 | - id: Expand 11 | translation: Expandera 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Mir 文档", 3 | "short_name": "Mir 文档", 4 | "start_url": "/", 5 | "scope": "/", 6 | "display": "standalone", 7 | "background_color": "#000000", 8 | "theme_color": "#000000", 9 | "icons": [ 10 | { 11 | "src": "/favicon.svg", 12 | "sizes": "512x512" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/cs.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Vyhledávat 3 | 4 | - id: Edit this page 5 | translation: Upravit tuto stránku 6 | 7 | - id: Last modified by 8 | translation: Autor poslední změny 9 | 10 | - id: Expand 11 | translation: Rozbalit 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/public/en/categories/page/1/index.html: -------------------------------------------------------------------------------- 1 | https://alimy.github.io/mir/en/categories/ 2 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/fr.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Rechercher 3 | 4 | - id: Edit this page 5 | translation: Modifier cette page 6 | 7 | - id: Last modified by 8 | translation: Dernière modification par 9 | 10 | - id: Expand 11 | translation: Développer 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/details.html: -------------------------------------------------------------------------------- 1 |
2 | {{- $summary := cond .IsNamedParams (.Get "title") (.Get 0) -}} 3 | {{ $summary | .Page.RenderString }} 4 |
5 | {{ .Inner | .Page.RenderString }} 6 |
7 |
8 | -------------------------------------------------------------------------------- /mirc/go.mod: -------------------------------------------------------------------------------- 1 | module github.com/alimy/mir/mirc/v5 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/Masterminds/semver/v3 v3.3.1 7 | github.com/alimy/embedx v0.6.1 8 | github.com/spf13/cobra v1.9.1 9 | ) 10 | 11 | require ( 12 | github.com/inconshreveable/mousetrap v1.1.0 // indirect 13 | github.com/spf13/pflag v1.0.6 // indirect 14 | ) 15 | -------------------------------------------------------------------------------- /mirc/templates/hertz/main.go.tmpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "{{ .PkgName }}/servants" 5 | 6 | "github.com/cloudwego/hertz/pkg/app/server" 7 | ) 8 | 9 | func main() { 10 | h := server.Default() 11 | 12 | // register servants to hertz 13 | servants.RegisterServants(h.Engine) 14 | 15 | // start servant service 16 | h.Spin() 17 | } 18 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/bn.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: অনুসন্ধান 3 | 4 | - id: Edit this page 5 | translation: এই পৃষ্ঠাটি সম্পাদনা করুন 6 | 7 | - id: Last modified by 8 | translation: সর্বশেষ সম্পাদনা করেছেন 9 | 10 | - id: Expand 11 | translation: বিস্তৃত করা 12 | 13 | - id: bookSearchConfig 14 | translation: '{ cache: true }' 15 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/uk.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Пошук 3 | 4 | - id: Edit this page 5 | translation: Редагувати цю сторінку 6 | 7 | - id: Last modified by 8 | translation: Остання зміна від 9 | 10 | - id: Expand 11 | translation: Розгорнути 12 | 13 | - id: bookSearchConfig 14 | translation: '{ split: /[^a-zа-яё0-9\w]/gi }' 15 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0006_comment_thumbs.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_comment DROP COLUMN thumbs_up_count; 2 | ALTER TABLE p_comment DROP COLUMN thumbs_down_count; 3 | ALTER TABLE p_comment_reply DROP COLUMN thumbs_up_count; 4 | ALTER TABLE p_comment_reply DROP COLUMN thumbs_down_count; 5 | 6 | DROP TABLE IF EXISTS p_tweet_comment_thumbs; 7 | -------------------------------------------------------------------------------- /internal/naming/naming.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package naming 6 | 7 | // NamingStrategy naming strategy interface 8 | type NamingStrategy interface { 9 | Naming(string) string 10 | } 11 | -------------------------------------------------------------------------------- /docs/content.zh/docs/quck-start/projects-use-go-mir.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "使用go-mir的项目" 3 | --- 4 | 5 | ## 使用go-mir的项目 6 | * [examples](https://github.com/alimy/mir/tree/main/examples) - 本项目自带的demo,主要演示了如何使用[Mir](https://github.com/alimy/mir)快速进行RESTful API的后端开发。 7 | * [paopao-ce](https://github.com/rocboss/paopao-ce/tree/dev) - 一个清新文艺的微社区,提供类似Twiter/微博的推文分享服务。 8 | -------------------------------------------------------------------------------- /engine/internal/internal.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package internal 6 | 7 | type Loader interface { 8 | Load() error 9 | } 10 | 11 | func NewLoader(c *Config) Loader { 12 | return c 13 | } 14 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/ru.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Поиск 3 | 4 | - id: Edit this page 5 | translation: Редактировать эту страницу 6 | 7 | - id: Last modified by 8 | translation: Последнее изменение от 9 | 10 | - id: Expand 11 | translation: Развернуть 12 | 13 | - id: bookSearchConfig 14 | translation: '{ split: /[^a-zа-яё0-9\w]/gi }' 15 | -------------------------------------------------------------------------------- /examples/sail-example/pkg/debug/errors.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package debug 6 | 7 | import ( 8 | "errors" 9 | ) 10 | 11 | var ( 12 | ErrNotImplemented = errors.New("not implemented") 13 | ) 14 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/posts/single.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 | 9 | {{ end }} 10 | 11 | {{ define "toc" }} 12 | {{ partial "docs/toc" . }} 13 | {{ end }} 14 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0007_comment_thumbs.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_comment` DROP COLUMN `thumbs_up_count`; 2 | ALTER TABLE `p_comment` DROP COLUMN `thumbs_down_count`; 3 | ALTER TABLE `p_comment_reply` DROP COLUMN `thumbs_up_count`; 4 | ALTER TABLE `p_comment_reply` DROP COLUMN `thumbs_down_count`; 5 | 6 | DROP TABLE IF EXISTS `p_tweet_comment_thumbs`; 7 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/_print.scss: -------------------------------------------------------------------------------- 1 | @media print { 2 | .book-menu, 3 | .book-footer, 4 | .book-toc { 5 | display: none; 6 | } 7 | 8 | .book-header, 9 | .book-header aside { 10 | display: block; 11 | } 12 | 13 | main { 14 | // Fix for https://bugzilla.mozilla.org/show_bug.cgi?id=939897 15 | display: block !important; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/brand.html: -------------------------------------------------------------------------------- 1 |

2 | 3 | {{- with .Site.Params.BookLogo -}} 4 | Logo 5 | {{- end -}} 6 | {{ .Site.Title }} 7 | 8 |

9 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0007_comment_thumbs.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE "p_comment" DROP COLUMN "thumbs_up_count"; 2 | ALTER TABLE "p_comment" DROP COLUMN "thumbs_down_count"; 3 | ALTER TABLE "p_comment_reply" DROP COLUMN "thumbs_up_count"; 4 | ALTER TABLE "p_comment_reply" DROP COLUMN "thumbs_down_count"; 5 | 6 | DROP TABLE IF EXISTS "p_tweet_comment_thumbs"; 7 | -------------------------------------------------------------------------------- /docs/public/sitemap.xml: -------------------------------------------------------------------------------- 1 | https://alimy.github.io/mir/zh/sitemap.xml2025-06-17T19:05:08+08:00https://alimy.github.io/mir/en/sitemap.xml2025-06-17T19:05:08+08:00 -------------------------------------------------------------------------------- /docs/content.en/docs/recommends/_index.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 3 3 | bookFlatSection: true 4 | title: "Recommends" 5 | --- 6 | 7 | - [Yesql](https://alimy.github.io/yesql) - 🔥a help tool for develop database logic that use [sqlx](https://github.com/jmoiron/sqlx). 8 | - [paopao-ce](https://github.com/rocboss/paopao-ce/tree/dev) - 🔥an artistic "twitter like" community built on gin+zinc+vue+ts. 9 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/book.scss: -------------------------------------------------------------------------------- 1 | @import "defaults"; 2 | @import "variables"; 3 | @import "themes/{{ default "light" .Site.Params.BookTheme }}"; 4 | 5 | @import "normalize"; 6 | @import "utils"; 7 | @import "main"; 8 | @import "fonts"; 9 | @import "print"; 10 | 11 | @import "markdown"; 12 | @import "shortcodes"; 13 | 14 | // Custom defined styles 15 | @import "custom"; 16 | -------------------------------------------------------------------------------- /mirc/templates/gin/main.go.tmpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/gin-gonic/gin" 7 | "{{ .PkgName }}/servants" 8 | ) 9 | 10 | func main() { 11 | e := gin.Default() 12 | 13 | // register servants to gin 14 | servants.RegisterServants(e) 15 | 16 | // start servant service 17 | if err := e.Run(); err != nil { 18 | log.Fatal(err) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/search.html: -------------------------------------------------------------------------------- 1 | {{ if default true .Site.Params.BookSearch }} 2 | 7 | {{ end }} 8 | -------------------------------------------------------------------------------- /mirc/templates/echo/main.go.tmpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/labstack/echo/v4" 7 | "{{ .PkgName }}/servants" 8 | ) 9 | 10 | func main() { 11 | e := echo.New() 12 | 13 | // register servants to echo 14 | servants.RegisterServants(e) 15 | 16 | // start servant service 17 | if err := e.Start(":4000"); err != nil { 18 | log.Fatal(err) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /mirc/main.go: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "github.com/alimy/mir/mirc/v5/cmd" 5 | ) 6 | 7 | func main() { 8 | // setup root cli command of application 9 | cmd.Setup( 10 | "mirc", // command name 11 | "mir help toolkit", // command short describe 12 | "mir help tookit", // command long describe 13 | ) 14 | 15 | // execute start application 16 | cmd.Execute() 17 | } 18 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/embed.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | //go:build migration 6 | // +build migration 7 | 8 | package migration 9 | 10 | import ( 11 | "embed" 12 | ) 13 | 14 | //go:embed **/* 15 | var Files embed.FS 16 | -------------------------------------------------------------------------------- /mirc/templates/fiber/main.go.tmpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/gofiber/fiber/v2" 7 | "{{ .PkgName }}/servants" 8 | ) 9 | 10 | func main() { 11 | app := fiber.New() 12 | 13 | // register servants to fiber 14 | servants.RegisterServants(app) 15 | 16 | // start servant service 17 | if err := app.Listen(":3000"); err != nil { 18 | log.Fatal(err) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /mirc/templates/iris/main.go.tmpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | 6 | "github.com/kataras/iris/v12" 7 | "{{ .PkgName }}/servants" 8 | ) 9 | 10 | func main() { 11 | app := iris.New() 12 | 13 | // register servants to iris 14 | servants.RegisterServants(app) 15 | 16 | // start servant service 17 | if err := app.Run(iris.Addr(":8013")); err != nil { 18 | log.Fatal(err) 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /mirc/templates/mux/main.go.tmpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "net/http" 6 | 7 | "github.com/gorilla/mux" 8 | "{{ .PkgName }}/servants" 9 | ) 10 | 11 | func main() { 12 | r := mux.NewRouter() 13 | 14 | // register servants to chi 15 | servants.RegisterServants(r) 16 | 17 | // start servant service 18 | if err := http.ListenAndServe(":8080", r); err != nil { 19 | log.Fatal(err) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /mirc/templates/chi/main.go.tmpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "net/http" 6 | 7 | "github.com/go-chi/chi/v5" 8 | "{{ .PkgName }}/servants" 9 | ) 10 | 11 | func main() { 12 | r := chi.NewRouter() 13 | 14 | // register servants to chi 15 | servants.RegisterServants(r) 16 | 17 | // start servant service 18 | if err := http.ListenAndServe(":8080", r); err != nil { 19 | log.Fatal(err) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "{{ .Site.Title }}", 3 | "short_name": "{{ .Site.Title }}", 4 | "start_url": "{{ "/" | relURL }}", 5 | "scope": "{{ "/" | relURL }}", 6 | "display": "standalone", 7 | "background_color": "#000000", 8 | "theme_color": "#000000", 9 | "icons": [ 10 | { 11 | "src": "{{ "/favicon.svg" | relURL }}", 12 | "sizes": "512x512" 13 | } 14 | ] 15 | } 16 | -------------------------------------------------------------------------------- /service/runtime.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package service 6 | 7 | // Launch start task interface 8 | type Launch interface { 9 | Go(func()) 10 | } 11 | 12 | // Runtime service runtime interface 13 | type Runtime interface { 14 | Start(Launch) 15 | Stop() 16 | } 17 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/zh.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: 搜索 3 | 4 | - id: Edit this page 5 | translation: 编辑本页 6 | 7 | - id: Last modified by 8 | translation: 最后修改者 9 | 10 | - id: Expand 11 | translation: 展开 12 | 13 | - id: bookSearchConfig 14 | translation: | 15 | { 16 | encode: false, 17 | tokenize: function(str) { 18 | return str.replace(/[\x00-\x7F]/g, '').split(''); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/sail-example/config.yaml: -------------------------------------------------------------------------------- 1 | App: # APP基础设置项 2 | RunMode: debug 3 | 4 | Features: 5 | Default: ["Postgres", "Web", "Docs", "Bot"] 6 | 7 | WebServer: # Web服务 8 | Port: 8080 9 | 10 | BotServer: # Bot服务 11 | Port: 8081 12 | 13 | DocsServer: # 开发文档服务 14 | Port: 8082 15 | 16 | Postgres: # PostgreSQL数据库 17 | User: sail 18 | Password: sail123 19 | DBName: sail 20 | Schema: public 21 | Host: localhost 22 | Port: 5432 23 | -------------------------------------------------------------------------------- /docs/public/docs/index.xml: -------------------------------------------------------------------------------- 1 | Docs on Mir 文档https://alimy.github.io/mir/docs/Recent content in Docs on Mir 文档Hugo -- gohugo.iozh -------------------------------------------------------------------------------- /docs/public/svg/translate.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/public/tags/index.xml: -------------------------------------------------------------------------------- 1 | Tags on Mir 文档https://alimy.github.io/mir/tags/Recent content in Tags on Mir 文档Hugo -- gohugo.iozh -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/ja.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: 検索 3 | 4 | - id: Edit this page 5 | translation: このページを編集する 6 | 7 | - id: Last modified by 8 | translation: 最終更新者 9 | 10 | - id: Expand 11 | translation: 展開 12 | 13 | - id: bookSearchConfig 14 | translation: | 15 | { 16 | encode: false, 17 | tokenize: function(str) { 18 | return str.replace(/[\x00-\x7F]/g, '').split(''); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/zh-TW.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: 搜索 3 | 4 | - id: Edit this page 5 | translation: 編輯頁面 6 | 7 | - id: Last modified by 8 | translation: 最後修改者 9 | 10 | - id: Expand 11 | translation: 展開 12 | 13 | - id: bookSearchConfig 14 | translation: | 15 | { 16 | encode: false, 17 | tokenize: function(str) { 18 | return str.replace(/[\x00-\x7F]/g, '').split(''); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /examples/sail-example/pkg/debug/annotation.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package debug 6 | 7 | import ( 8 | "log" 9 | "log/slog" 10 | ) 11 | 12 | func TODO() { 13 | slog.Warn("in todo progress") 14 | } 15 | 16 | func NotImplemented() { 17 | log.Fatalln("not implemented") 18 | } 19 | -------------------------------------------------------------------------------- /examples/sail-example/pkg/xerror/common.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package xerror 6 | 7 | var ( 8 | Success = NewError(0, "成功") 9 | ServerError = NewError(10000, "服务内部错误") 10 | InvalidParams = NewError(10001, "入参错误") 11 | NotFound = NewError(10002, "找不到") 12 | ) 13 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0011_home_timeline.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `p_post_metric`; 2 | 3 | -- 原来的可见性: 0公开 1私密 2好友可见 3关注可见 4 | -- 现在的可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开 5 | UPDATE p_post a, p_post b 6 | SET a.visibility = ( 7 | CASE b.visibility 8 | WHEN 90 THEN 0 9 | WHEN 0 THEN 1 10 | WHEN 50 THEN 2 11 | WHEN 60 THEN 3 12 | ELSE 0 13 | END 14 | ) 15 | WHERE a.ID = b.ID; 16 | -------------------------------------------------------------------------------- /mirc/templates/chi/servants/site_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type siteSrvA struct { 8 | baseSrv 9 | 10 | api.UnimplementedSiteServant 11 | } 12 | 13 | type siteChainA struct { 14 | api.UnimplementedSiteChain 15 | } 16 | 17 | func newSiteSrvA() api.Site { 18 | return &siteSrvA{} 19 | } 20 | 21 | func newSiteChainA() api.SiteChain { 22 | return &siteChainA{} 23 | } 24 | -------------------------------------------------------------------------------- /mirc/templates/gin/servants/site_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type siteSrvA struct { 8 | baseSrv 9 | 10 | api.UnimplementedSiteServant 11 | } 12 | 13 | type siteChainA struct { 14 | api.UnimplementedSiteChain 15 | } 16 | 17 | func newSiteSrvA() api.Site { 18 | return &siteSrvA{} 19 | } 20 | 21 | func newSiteChainA() api.SiteChain { 22 | return &siteChainA{} 23 | } 24 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/taxonomy/list.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 |
3 |

{{ .Title | title }}

4 | {{ $taxonomies := index .Site.Taxonomies .Page.Type }} 5 | {{ range $taxonomies }} 6 | 7 | {{ end }} 8 |
9 | {{ end }} 10 | 11 | {{ define "toc" }} 12 | {{ partial "docs/taxonomy" . }} 13 | {{ end }} 14 | -------------------------------------------------------------------------------- /mirc/templates/hertz/servants/site_a.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | api "{{ .PkgName }}/mirc/auto/api/v1" 5 | ) 6 | 7 | type siteSrvA struct { 8 | baseSrv 9 | 10 | api.UnimplementedSiteServant 11 | } 12 | 13 | type siteChainA struct { 14 | api.UnimplementedSiteChain 15 | } 16 | 17 | func newSiteSrvA() api.Site { 18 | return &siteSrvA{} 19 | } 20 | 21 | func newSiteChainA() api.SiteChain { 22 | return &siteChainA{} 23 | } 24 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/main.go.tmpl: -------------------------------------------------------------------------------- 1 | package main 2 | 3 | import ( 4 | "log" 5 | "net/http" 6 | 7 | "github.com/julienschmidt/httprouter" 8 | "{{ .PkgName }}/servants" 9 | ) 10 | 11 | func main() { 12 | r := httprouter.New() 13 | 14 | // register servants to httprouter 15 | servants.RegisterServants(r) 16 | 17 | // start servant service 18 | if err := http.ListenAndServe(":8080", r); err != nil { 19 | log.Fatal(err) 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | .DS_Store 8 | 9 | coverage.out 10 | count.out 11 | test 12 | profile.out 13 | tmp.out 14 | 15 | # Test binary, build with `go test -c` 16 | *.test 17 | 18 | # Output of the go coverage tool, specifically when used with LiteIDE 19 | *.out 20 | 21 | # GoLand project files 22 | .idea/ 23 | *.iml 24 | 25 | .vscode 26 | /mir 27 | /go.work 28 | /go.work.sum -------------------------------------------------------------------------------- /docs/content.en/docs/quick-start/projects-use-go-mir.md: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Projects That Use go-mir" 3 | --- 4 | 5 | ## Projects That Use go-mir 6 | * [examples](https://github.com/alimy/mir/tree/main/examples) - a demo example to describe how to use [Mir](https://github.com/alimy/mir) to develop RESTful API backend service quickly. 7 | * [paopao-ce](https://github.com/rocboss/paopao-ce/tree/dev) - A artistic "twitter like" community built on gin+zinc+vue+ts. 8 | -------------------------------------------------------------------------------- /docs/public/en/docs/index.xml: -------------------------------------------------------------------------------- 1 | Docs on Mir Docshttps://alimy.github.io/mir/en/docs/Recent content in Docs on Mir DocsHugo -- gohugo.ioen -------------------------------------------------------------------------------- /docs/public/en/tags/index.xml: -------------------------------------------------------------------------------- 1 | Tags on Mir Docshttps://alimy.github.io/mir/en/tags/Recent content in Tags on Mir DocsHugo -- gohugo.ioen -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/tab.html: -------------------------------------------------------------------------------- 1 | {{ if .Parent }} 2 | {{ $name := .Get 0 }} 3 | {{ $group := printf "tabs-%s" (.Parent.Get 0) }} 4 | 5 | {{ if not (.Parent.Scratch.Get $group) }} 6 | {{ .Parent.Scratch.Set $group slice }} 7 | {{ end }} 8 | 9 | {{ .Parent.Scratch.Add $group (dict "Name" $name "Content" .Inner) }} 10 | {{ else }} 11 | {{ errorf "%q: 'tab' shortcode must be inside 'tabs' shortcode" .Page.Path }} 12 | {{ end}} 13 | -------------------------------------------------------------------------------- /mirc/templates/chi/go.mod.tmpl: -------------------------------------------------------------------------------- 1 | module {{ .PkgName }} 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/alimy/mir/v5 v5.2.3 7 | github.com/go-chi/chi/v5 v5.2.1 8 | ) 9 | 10 | require ( 11 | golang.org/x/mod v0.24.0 // indirect 12 | golang.org/x/sync v0.14.0 // indirect 13 | golang.org/x/tools v0.33.0 // indirect 14 | ) 15 | 16 | {{- if notEmptyStr .MirPkgName }} 17 | replace ( 18 | github.com/alimy/mir/v5 => {{ .MirPkgName }} 19 | ) 20 | {{end -}} 21 | -------------------------------------------------------------------------------- /mirc/templates/mux/go.mod.tmpl: -------------------------------------------------------------------------------- 1 | module {{ .PkgName }} 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/alimy/mir/v5 v5.2.3 7 | github.com/gorilla/mux v1.8.1 8 | ) 9 | 10 | require ( 11 | golang.org/x/mod v0.24.0 // indirect 12 | golang.org/x/sync v0.14.0 // indirect 13 | golang.org/x/tools v0.33.0 // indirect 14 | ) 15 | 16 | {{- if notEmptyStr .MirPkgName }} 17 | replace ( 18 | github.com/alimy/mir/v5 => {{ .MirPkgName }} 19 | ) 20 | {{end -}} 21 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/static/svg/translate.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/ko.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: Search 3 | 4 | - id: Edit this page 5 | translation: Edit this page 6 | 7 | - id: Last modified by 8 | translation: Last modified by 9 | 10 | - id: Expand 11 | translation: Expand 12 | 13 | - id: bookSearchConfig 14 | translation: | 15 | { 16 | encode: false, 17 | tokenize: function(str) { 18 | return str.replace(/[\x00-\x7F]/g, '').split(''); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/button.html: -------------------------------------------------------------------------------- 1 | {{ $ref := "" }} 2 | {{ $target := "" }} 3 | {{ with .Get "href" }} 4 | {{ $ref = . }} 5 | {{ $target = "_blank" }} 6 | {{ end }} 7 | {{ with .Get "relref" }} 8 | {{ $ref = relref $ . }} 9 | {{ end }} 10 | 11 | {{ .Inner | .Page.RenderString }} 12 | 13 | -------------------------------------------------------------------------------- /examples/sail-example/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package main 6 | 7 | import ( 8 | "github.com/alimy/mir/sail-example/v5/cmd" 9 | _ "github.com/alimy/mir/sail-example/v5/cmd/migrate" 10 | _ "github.com/alimy/mir/sail-example/v5/cmd/serve" 11 | ) 12 | 13 | func main() { 14 | cmd.Execute() 15 | } 16 | -------------------------------------------------------------------------------- /docs/public/categories/index.xml: -------------------------------------------------------------------------------- 1 | Categories on Mir 文档https://alimy.github.io/mir/categories/Recent content in Categories on Mir 文档Hugo -- gohugo.iozh -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0010_home_timeline.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS p_post_metric; 2 | 3 | -- 原来的可见性: 0公开 1私密 2好友可见 3关注可见 4 | -- 现在的可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开 5 | UPDATE p_post a 6 | SET visibility = ( 7 | SELECT 8 | CASE visibility 9 | WHEN 90 THEN 0 10 | WHEN 0 THEN 1 11 | WHEN 50 THEN 2 12 | WHEN 60 THEN 3 13 | ELSE 0 14 | END 15 | FROM 16 | p_post b 17 | WHERE 18 | a.ID = b.ID 19 | ); -------------------------------------------------------------------------------- /docs/public/docs/recommends/index.xml: -------------------------------------------------------------------------------- 1 | 推荐项目 on Mir 文档https://alimy.github.io/mir/docs/recommends/Recent content in 推荐项目 on Mir 文档Hugo -- gohugo.iozh -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0009_user_following.up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE p_following ( 2 | id BIGSERIAL PRIMARY KEY, 3 | user_id BIGINT NOT NULL, 4 | follow_id BIGINT NOT NULL, 5 | is_del SMALLINT NOT NULL DEFAULT 0, -- 是否删除, 0否, 1是 6 | created_on BIGINT NOT NULL DEFAULT 0, 7 | modified_on BIGINT NOT NULL DEFAULT 0, 8 | deleted_on BIGINT NOT NULL DEFAULT 0 9 | ); 10 | CREATE INDEX idx_following_user_follow ON p_following USING btree (user_id, follow_id); 11 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/go.mod.tmpl: -------------------------------------------------------------------------------- 1 | module {{ .PkgName }} 2 | 3 | go 1.24.0 4 | 5 | require ( 6 | github.com/alimy/mir/v5 v5.2.3 7 | github.com/julienschmidt/httprouter v1.3.0 8 | ) 9 | 10 | require ( 11 | golang.org/x/mod v0.24.0 // indirect 12 | golang.org/x/sync v0.14.0 // indirect 13 | golang.org/x/tools v0.33.0 // indirect 14 | ) 15 | 16 | {{- if notEmptyStr .MirPkgName }} 17 | replace ( 18 | github.com/alimy/mir/v5 => {{ .MirPkgName }} 19 | ) 20 | {{end -}} 21 | -------------------------------------------------------------------------------- /service/help.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package service 6 | 7 | import ( 8 | "io" 9 | "os" 10 | ) 11 | 12 | var ( 13 | _output io.Writer = os.Stdout 14 | ) 15 | 16 | // SetOutput set log output writer. default is os.Stdout 17 | func SetOutput(w io.Writer) { 18 | if w != nil { 19 | _output = w 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/mermaid.html: -------------------------------------------------------------------------------- 1 | {{ if not (.Page.Scratch.Get "mermaid") }} 2 | 3 | 4 | {{ with resources.Get "mermaid.json" }} 5 | 6 | {{ end }} 7 | {{ .Page.Scratch.Set "mermaid" true }} 8 | {{ end }} 9 | 10 |

11 | {{- .Inner -}} 12 |

13 | -------------------------------------------------------------------------------- /examples/mir-example/servants/site.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package servants 6 | 7 | import ( 8 | "github.com/alimy/mir/mir-example/v5/mirc/auto/api" 9 | ) 10 | 11 | type siteSrv struct { 12 | baseSrv 13 | api.UnimplementedSiteServant 14 | } 15 | 16 | func newSiteSrv() api.Site { 17 | return &siteSrv{} 18 | } 19 | -------------------------------------------------------------------------------- /examples/sail-example/internal/servants/docs/docs.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | //go:build !docs 6 | // +build !docs 7 | 8 | package docs 9 | 10 | import ( 11 | "github.com/gin-gonic/gin" 12 | ) 13 | 14 | // RouteDocs stub function for register docs asset route 15 | func RouteDocs(e *gin.Engine) { 16 | // empty 17 | } 18 | -------------------------------------------------------------------------------- /mirc/templates/chi/.gitignore.tmpl: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # Mir generate files 25 | .mirc 26 | 27 | # VS Code 28 | .vscode 29 | -------------------------------------------------------------------------------- /mirc/templates/echo/.gitignore.tmpl: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # Mir generate files 25 | .mirc 26 | 27 | # VS Code 28 | .vscode 29 | -------------------------------------------------------------------------------- /mirc/templates/fiber/.gitignore.tmpl: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # Mir generate files 25 | .mirc 26 | 27 | # VS Code 28 | .vscode 29 | -------------------------------------------------------------------------------- /mirc/templates/gin/.gitignore.tmpl: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # Mir generate files 25 | .mirc 26 | 27 | # VS Code 28 | .vscode 29 | -------------------------------------------------------------------------------- /mirc/templates/hertz/.gitignore.tmpl: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # Mir generate files 25 | .mirc 26 | 27 | # VS Code 28 | .vscode 29 | -------------------------------------------------------------------------------- /mirc/templates/iris/.gitignore.tmpl: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # Mir generate files 25 | .mirc 26 | 27 | # VS Code 28 | .vscode 29 | -------------------------------------------------------------------------------- /mirc/templates/mux/.gitignore.tmpl: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # Mir generate files 25 | .mirc 26 | 27 | # VS Code 28 | .vscode 29 | -------------------------------------------------------------------------------- /docs/public/en/categories/index.xml: -------------------------------------------------------------------------------- 1 | Categories on Mir Docshttps://alimy.github.io/mir/en/categories/Recent content in Categories on Mir DocsHugo -- gohugo.ioen -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0011_home_timeline.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS "p_post_metric"; 2 | 3 | -- 原来的可见性: 0公开 1私密 2好友可见 3关注可见 4 | -- 现在的可见性: 0私密 10充电可见 20订阅可见 30保留 40保留 50好友可见 60关注可见 70保留 80保留 90公开 5 | UPDATE p_post AS a 6 | SET visibility = ( 7 | SELECT 8 | CASE visibility 9 | WHEN 90 THEN 0 10 | WHEN 0 THEN 1 11 | WHEN 50 THEN 2 12 | WHEN 60 THEN 3 13 | ELSE 0 14 | END 15 | FROM 16 | p_post AS b 17 | WHERE 18 | a.ID = b.ID 19 | ); 20 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/.gitignore.tmpl: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # Mir generate files 25 | .mirc 26 | 27 | # VS Code 28 | .vscode 29 | -------------------------------------------------------------------------------- /mirc/templates/macaron/.gitignore.tmpl: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # Mir generate files 25 | .mirc 26 | 27 | # VS Code 28 | .vscode 29 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0010_user_following.up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE "p_following" ( 2 | "id" integer NOT NULL, 3 | "user_id" integer NOT NULL, 4 | "follow_id" integer NOT NULL, 5 | "is_del" integer NOT NULL, 6 | "created_on" integer NOT NULL, 7 | "modified_on" integer NOT NULL, 8 | "deleted_on" integer NOT NULL, 9 | PRIMARY KEY ("id") 10 | ); 11 | CREATE INDEX "idx_following_user_follow" 12 | ON "p_following" ( 13 | "user_id" ASC, 14 | "follow_id" ASC 15 | ); 16 | -------------------------------------------------------------------------------- /mirc/templates/mux/servants/servants.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "github.com/gorilla/mux" 5 | "{{ .PkgName }}/mirc/auto/api" 6 | v1 "{{ .PkgName }}/mirc/auto/api/v1" 7 | v2 "{{ .PkgName }}/mirc/auto/api/v2" 8 | ) 9 | 10 | // RegisterServants register all the servants to mux.Router 11 | func RegisterServants(e *mux.Router) { 12 | api.RegisterSiteServant(e, newSiteSrv()) 13 | v1.RegisterSiteServant(e, newSiteSrvA()) 14 | v2.RegisterSiteServant(e, newSiteSrvB()) 15 | } 16 | -------------------------------------------------------------------------------- /examples/mir-example/servants/site_b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package servants 6 | 7 | import ( 8 | api "github.com/alimy/mir/mir-example/v5/mirc/auto/api/v2" 9 | ) 10 | 11 | type siteSrvB struct { 12 | baseSrv 13 | 14 | api.UnimplementedSiteServant 15 | } 16 | 17 | func newSiteSrvB() api.Site { 18 | return &siteSrvB{} 19 | } 20 | -------------------------------------------------------------------------------- /examples/mir-example/servants/site_c.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package servants 6 | 7 | import ( 8 | api "github.com/alimy/mir/mir-example/v5/mirc/auto/api/v3" 9 | ) 10 | 11 | type siteSrvC struct { 12 | baseSrv 13 | 14 | api.UnimplementedSiteServant 15 | } 16 | 17 | func newSiteSrvC() api.Site { 18 | return &siteSrvC{} 19 | } 20 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0007_content_type_alter.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE p_post_content ALTER COLUMN content SET DATA TYPE TEXT, ALTER COLUMN content SET NOT NULL, ALTER COLUMN content SET DEFAULT ''; 2 | ALTER TABLE p_comment_content ALTER COLUMN content SET DATA TYPE TEXT, ALTER COLUMN content SET NOT NULL, ALTER COLUMN content SET DEFAULT ''; 3 | ALTER TABLE p_comment_reply ALTER COLUMN content SET DATA TYPE TEXT, ALTER COLUMN content SET NOT NULL, ALTER COLUMN content SET DEFAULT ''; 4 | -------------------------------------------------------------------------------- /mirc/templates/echo/servants/servants.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "github.com/labstack/echo/v4" 5 | "{{ .PkgName }}/mirc/auto/api" 6 | v1 "{{ .PkgName }}/mirc/auto/api/v1" 7 | v2 "{{ .PkgName }}/mirc/auto/api/v2" 8 | ) 9 | 10 | // RegisterServants register all the servants to echo.Echo 11 | func RegisterServants(e *echo.Echo) { 12 | api.RegisterSiteServant(e, newSiteSrv()) 13 | v1.RegisterSiteServant(e, newSiteSrvA()) 14 | v2.RegisterSiteServant(e, newSiteSrvB()) 15 | } 16 | -------------------------------------------------------------------------------- /docs/public/en/docs/recommends/index.xml: -------------------------------------------------------------------------------- 1 | Recommends on Mir Docshttps://alimy.github.io/mir/en/docs/recommends/Recent content in Recommends on Mir DocsHugo -- gohugo.ioen -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/cn.yaml: -------------------------------------------------------------------------------- 1 | # This should be removed in future, 'cn' is moved to `zh' 2 | - id: Search 3 | translation: 搜索 4 | 5 | - id: Edit this page 6 | translation: 编辑本页 7 | 8 | - id: Last modified by 9 | translation: 最后修改者 10 | 11 | - id: Expand 12 | translation: 展开 13 | 14 | - id: bookSearchConfig 15 | translation: | 16 | { 17 | encode: false, 18 | tokenize: function(str) { 19 | return str.replace(/[\x00-\x7F]/g, '').split(''); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/mir-example/servants/admin_a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package servants 6 | 7 | import ( 8 | api "github.com/alimy/mir/mir-example/v5/mirc/auto/api/v1" 9 | ) 10 | 11 | type adminSrvA struct { 12 | baseSrv 13 | 14 | api.UnimplementedAdminServant 15 | } 16 | 17 | func newAdminSrvA() api.Admin { 18 | return &adminSrvA{} 19 | } 20 | -------------------------------------------------------------------------------- /examples/sail-example/internal/servants/bot/bot.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package bot 6 | 7 | import ( 8 | api "github.com/alimy/mir/sail-example/v5/auto/api/bot/v1" 9 | "github.com/gin-gonic/gin" 10 | ) 11 | 12 | // RouteBot register Bot route 13 | func RouteBot(e *gin.Engine) { 14 | api.RegisterUserServant(e, newUserSrv()) 15 | } 16 | -------------------------------------------------------------------------------- /mirc/templates/macaron/servants/servants.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "gopkg.in/macaron.v1" 5 | "{{ .PkgName }}/mirc/auto/api" 6 | v1 "{{ .PkgName }}/mirc/auto/api/v1" 7 | v2 "{{ .PkgName }}/mirc/auto/api/v2" 8 | ) 9 | 10 | // RegisterServants register all the servants to macaron.Macaron 11 | func RegisterServants(e *macaron.Macaron) { 12 | api.RegisterSiteServant(e, newSiteSrv()) 13 | v1.RegisterSiteServant(e, newSiteSrvA()) 14 | v2.RegisterSiteServant(e, newSiteSrvB()) 15 | } 16 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/jp.yaml: -------------------------------------------------------------------------------- 1 | # This should be removed in future, 'jp' is moved to `ja' 2 | - id: Search 3 | translation: 検索 4 | 5 | - id: Edit this page 6 | translation: このページを編集する 7 | 8 | - id: Last modified by 9 | translation: 最終更新者 10 | 11 | - id: Expand 12 | translation: 展開 13 | 14 | - id: bookSearchConfig 15 | translation: | 16 | { 17 | encode: false, 18 | tokenize: function(str) { 19 | return str.replace(/[\x00-\x7F]/g, '').split(''); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /examples/mir-example/Makefile: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /mirc/templates/fiber/servants/servants.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "github.com/gofiber/fiber/v2" 5 | "{{ .PkgName }}/mirc/auto/api" 6 | v1 "{{ .PkgName }}/mirc/auto/api/v1" 7 | v2 "{{ .PkgName }}/mirc/auto/api/v2" 8 | ) 9 | 10 | // RegisterServants register all the servants to fiber.App 11 | func RegisterServants(app *fiber.App) { 12 | api.RegisterSiteServant(app, newSiteSrv()) 13 | v1.RegisterSiteServant(app, newSiteSrvA()) 14 | v2.RegisterSiteServant(app, newSiteSrvB()) 15 | } 16 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/i18n/fa.yaml: -------------------------------------------------------------------------------- 1 | - id: Search 2 | translation: جستجو 3 | 4 | - id: Edit this page 5 | translation: این صفحه را ویرایش کنید 6 | 7 | - id: Last modified by 8 | translation: آخرین بار ویرایش شده توسط 9 | 10 | - id: Expand 11 | translation: بسط دادن 12 | 13 | - id: Categories 14 | translation: دسته بندی ها 15 | 16 | - id: Tags 17 | translation: تگ ها 18 | 19 | - id: bookSearchConfig 20 | translation: '{ cache: true, encode: false, rtl: true, split: /\s+/, tokenize: "forward"}' 21 | -------------------------------------------------------------------------------- /examples/mir-example/.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | *.exe 3 | *.exe~ 4 | *.dll 5 | *.so 6 | *.dylib 7 | 8 | coverage.out 9 | count.out 10 | test 11 | profile.out 12 | tmp.out 13 | 14 | # Test binary, build with `go test -c` 15 | *.test 16 | 17 | # Output of the go coverage tool, specifically when used with LiteIDE 18 | *.out 19 | 20 | # GoLand project files 21 | .idea/ 22 | *.iml 23 | 24 | # VS Code 25 | .vscode 26 | 27 | # mirc generate files 28 | .mirc 29 | 30 | /examples 31 | /mir-example 32 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0008_content_type_alter.down.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post_content` MODIFY COLUMN `content` varchar(2000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '内容'; 2 | ALTER TABLE `p_comment_content` MODIFY COLUMN `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '内容'; 3 | ALTER TABLE `p_comment_reply` MODIFY COLUMN `content` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '内容'; -------------------------------------------------------------------------------- /mirc/templates/chi/Makefile.tmpl: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o mir-examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /mirc/templates/echo/Makefile.tmpl: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o mir-examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /mirc/templates/fiber/Makefile.tmpl: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o mir-examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /mirc/templates/gin/Makefile.tmpl: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o mir-examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /mirc/templates/hertz/Makefile.tmpl: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o mir-examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /mirc/templates/iris/Makefile.tmpl: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o mir-examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /mirc/templates/iris/servants/servants.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "github.com/kataras/iris/v12" 5 | "{{ .PkgName }}/mirc/auto/api" 6 | v1 "{{ .PkgName }}/mirc/auto/api/v1" 7 | v2 "{{ .PkgName }}/mirc/auto/api/v2" 8 | ) 9 | 10 | // RegisterServants register all the servants to iris.Application 11 | func RegisterServants(app *iris.Application) { 12 | api.RegisterSiteServant(app, newSiteSrv()) 13 | v1.RegisterSiteServant(app, newSiteSrvA()) 14 | v2.RegisterSiteServant(app, newSiteSrvB()) 15 | } 16 | -------------------------------------------------------------------------------- /mirc/templates/macaron/Makefile.tmpl: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o mir-examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /mirc/templates/mux/Makefile.tmpl: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o mir-examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0008_content_type_alter.up.sql: -------------------------------------------------------------------------------- 1 | ALTER TABLE `p_post_content` MODIFY COLUMN `content` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '内容'; 2 | ALTER TABLE `p_comment_content` MODIFY COLUMN `content` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '内容'; 3 | ALTER TABLE `p_comment_reply` MODIFY COLUMN `content` varchar(4000) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '内容'; 4 | -------------------------------------------------------------------------------- /internal/generator/generator_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package generator 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/alimy/mir/v5/core" 11 | ) 12 | 13 | func TestMirGenerator_Init(t *testing.T) { 14 | g := &mirGenerator{name: core.GeneratorGin} 15 | if err := g.Init(nil); err == nil { 16 | t.Error("want an error but not") 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/Makefile.tmpl: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: run 6 | 7 | .PHONY: build 8 | build: fmt 9 | go build -o mir-examples main.go 10 | 11 | .PHONY: build 12 | run: fmt 13 | go run main.go 14 | 15 | .PHONY: mod-tidy 16 | mod-tidy: 17 | @go mod download 18 | @go mod tidy 19 | 20 | .PHONY: generate 21 | generate: 22 | @go generate mirc/gen.go 23 | @$(GOFMT) ./ 24 | 25 | .PHONY: fmt 26 | fmt: 27 | $(GOFMT) $(GOFILES) 28 | -------------------------------------------------------------------------------- /docs/content.zh/docs/tutorials/app-start.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 25 3 | title: "程序启动" 4 | --- 5 | 6 | ## 程序启动: 7 | ```go 8 | // file: main.go 9 | 10 | package main 11 | 12 | import ( 13 | "log" 14 | 15 | "github.com/alimy/mir-example/v4/servants" 16 | "github.com/gin-gonic/gin" 17 | ) 18 | 19 | func main() { 20 | e := gin.Default() 21 | 22 | // register servants to gin 23 | servants.RegisterServants(e) 24 | 25 | // start servant service 26 | if err := e.Run(); err != nil { 27 | log.Fatal(err) 28 | } 29 | } 30 | ``` 31 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/content.en/docs/shortcodes/buttons.md: -------------------------------------------------------------------------------- 1 | # Buttons 2 | 3 | Buttons are styled links that can lead to local page or external link. 4 | 5 | ## Example 6 | 7 | ```tpl 8 | {{}}Get Home{{}} 9 | {{}}Contribute{{}} 10 | ``` 11 | 12 | {{< button relref="/" >}}Get Home{{< /button >}} 13 | {{< button href="https://github.com/alex-shpak/hugo-book" >}}Contribute{{< /button >}} 14 | -------------------------------------------------------------------------------- /docs/content.zh/docs/tutorials/servant-register.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 24 3 | title: "服务注册" 4 | --- 5 | 6 | ## 服务注册 7 | ```go 8 | // file: servants/servants.go 9 | 10 | package servants 11 | 12 | import ( 13 | api "github.com/alimy/mir-example/v4/mirc/auto/api/v1" 14 | "github.com/gin-gonic/gin" 15 | ) 16 | 17 | // RegisterServants register all the servants to gin.Engine 18 | func RegisterServants(e *gin.Engine) { 19 | api.RegisterUserServant(e, newUserSrv()) 20 | 21 | // TODO: some other servant to register 22 | } 23 | ``` 24 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/header.html: -------------------------------------------------------------------------------- 1 |
2 | 5 | 6 | {{ partial "docs/title" . }} 7 | 8 | 13 |
14 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/title.html: -------------------------------------------------------------------------------- 1 | 5 | {{ $title := "" }} 6 | 7 | {{ if .LinkTitle }} 8 | {{ $title = .LinkTitle }} 9 | {{ else if .Title }} 10 | {{ $title = .Title }} 11 | {{ else if and .IsSection .File }} 12 | {{ $title = path.Base .File.Dir | humanize | title }} 13 | {{ else if and .IsPage .File }} 14 | {{ $title = .File.BaseFileName | humanize | title }} 15 | {{ end }} 16 | 17 | {{ return $title }} 18 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/expand.html: -------------------------------------------------------------------------------- 1 | {{ warnf "Expand shortcode is deprecated. Use 'details' instead." }} 2 |
3 | 13 |
14 | -------------------------------------------------------------------------------- /examples/sail-example/.gitignore: -------------------------------------------------------------------------------- 1 | # Binaries for programs and plugins 2 | .DS_Store 3 | *.exe 4 | *.exe~ 5 | *.dll 6 | *.so 7 | *.dylib 8 | 9 | coverage.out 10 | count.out 11 | test 12 | profile.out 13 | tmp.out 14 | 15 | # Test binary, build with `go test -c` 16 | *.test 17 | 18 | # Output of the go coverage tool, specifically when used with LiteIDE 19 | *.out 20 | 21 | # GoLand project files 22 | .idea/ 23 | *.iml 24 | 25 | # VS Code 26 | .vscode 27 | 28 | # mirc generate files 29 | .mirc 30 | 31 | /examples 32 | /sail-example 33 | -------------------------------------------------------------------------------- /docs/content.en/docs/tutorials/app-start.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 25 3 | title: "App Start" 4 | --- 5 | 6 | ## App Start: 7 | ```go 8 | // file: main.go 9 | 10 | package main 11 | 12 | import ( 13 | "log" 14 | 15 | "github.com/alimy/mir-example/v4/servants" 16 | "github.com/gin-gonic/gin" 17 | ) 18 | 19 | func main() { 20 | e := gin.Default() 21 | 22 | // register servants to gin 23 | servants.RegisterServants(e) 24 | 25 | // start servant service 26 | if err := e.Run(); err != nil { 27 | log.Fatal(err) 28 | } 29 | } 30 | ``` 31 | -------------------------------------------------------------------------------- /.golangci.yml: -------------------------------------------------------------------------------- 1 | linters-settings: 2 | staticcheck: 3 | checks: [ 4 | "all", 5 | "-SA1019" # There are valid use cases of strings.Title 6 | ] 7 | nakedret: 8 | max-func-lines: 0 # Disallow any unnamed return statement 9 | 10 | linters: 11 | enable: 12 | # - unused 13 | # - errcheck 14 | # - gosimple 15 | - govet 16 | # - ineffassign 17 | # - staticcheck 18 | # - typecheck 19 | # - nakedret 20 | - gofmt 21 | # - rowserrcheck 22 | # - unconvert 23 | - goimports 24 | # - unparam 25 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/plugins/_scrollbars.scss: -------------------------------------------------------------------------------- 1 | @import "defaults"; 2 | @import "variables"; 3 | 4 | // Webkit 5 | ::-webkit-scrollbar { 6 | width: $padding-8; 7 | } 8 | 9 | ::-webkit-scrollbar-thumb { 10 | background: transparent; 11 | border-radius: $padding-8; 12 | } 13 | 14 | :hover::-webkit-scrollbar-thumb { 15 | background: var(--gray-500); 16 | } 17 | 18 | // MS 19 | body { 20 | -ms-overflow-style: -ms-autohiding-scrollbar; 21 | } 22 | 23 | // Future 24 | .book-menu nav { 25 | scrollbar-color: transparent var(--gray-500); 26 | } 27 | -------------------------------------------------------------------------------- /examples/sail-example/internal/servants/web/site.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package web 6 | 7 | import ( 8 | "github.com/alimy/mir/sail-example/v5/auto/api" 9 | "github.com/alimy/mir/sail-example/v5/internal/servants/base" 10 | ) 11 | 12 | type siteSrv struct { 13 | base.BaseSrv 14 | api.UnimplementedSiteServant 15 | } 16 | 17 | func newSiteSrv() api.Site { 18 | return &siteSrv{} 19 | } 20 | -------------------------------------------------------------------------------- /docs/content.en/docs/tutorials/servant-register.md: -------------------------------------------------------------------------------- 1 | 2 | --- 3 | weight: 24 4 | title: "Servant Register" 5 | --- 6 | 7 | ## Servant Register: 8 | ```go 9 | // file: servants/servants.go 10 | 11 | package servants 12 | 13 | import ( 14 | api "github.com/alimy/mir-example/v4/mirc/auto/api/v1" 15 | "github.com/gin-gonic/gin" 16 | ) 17 | 18 | // RegisterServants register all the servants to gin.Engine 19 | func RegisterServants(e *gin.Engine) { 20 | api.RegisterUserServant(e, newUserSrv()) 21 | 22 | // TODO: some other servant to register 23 | } 24 | ``` 25 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/content.en/docs/shortcodes/section/first-page.md: -------------------------------------------------------------------------------- 1 | # First page 2 | 3 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 4 | 5 | 6 | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 7 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/content.en/docs/shortcodes/section/second-page.md: -------------------------------------------------------------------------------- 1 | # Second Page 2 | Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. 3 | 4 | 5 | Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. 6 | 7 | -------------------------------------------------------------------------------- /mirc/templates/chi/mirc/gen.go.tmpl: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | . "github.com/alimy/mir/v5/core" 10 | . "github.com/alimy/mir/v5/engine" 11 | ) 12 | 13 | //go:generate go run $GOFILE 14 | func main() { 15 | log.Println("generate code start") 16 | if err := Generate( 17 | UseChi(), 18 | Schema("routes"), 19 | SinkPath("auto"), 20 | WatchCtxDone(true), 21 | RunMode(InSerialMode), 22 | ); err != nil { 23 | log.Fatal(err) 24 | } 25 | log.Println("generate code finish") 26 | } 27 | -------------------------------------------------------------------------------- /mirc/templates/echo/mirc/gen.go.tmpl: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | . "github.com/alimy/mir/v5/core" 10 | . "github.com/alimy/mir/v5/engine" 11 | ) 12 | 13 | //go:generate go run $GOFILE 14 | func main() { 15 | log.Println("generate code start") 16 | if err := Generate( 17 | UseEcho(), 18 | Schema("routes"), 19 | SinkPath("auto"), 20 | WatchCtxDone(true), 21 | RunMode(InSerialMode), 22 | ); err != nil { 23 | log.Fatal(err) 24 | } 25 | log.Println("generate code finish") 26 | } 27 | -------------------------------------------------------------------------------- /mirc/templates/gin/mirc/gen.go.tmpl: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | . "github.com/alimy/mir/v5/core" 10 | . "github.com/alimy/mir/v5/engine" 11 | ) 12 | 13 | //go:generate go run $GOFILE 14 | func main() { 15 | log.Println("generate code start") 16 | if err := Generate( 17 | UseGin(), 18 | Schema("routes"), 19 | SinkPath("auto"), 20 | WatchCtxDone(true), 21 | RunMode(InSerialMode), 22 | ); err != nil { 23 | log.Fatal(err) 24 | } 25 | log.Println("generate code finish") 26 | } 27 | -------------------------------------------------------------------------------- /mirc/templates/iris/mirc/gen.go.tmpl: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | . "github.com/alimy/mir/v5/core" 10 | . "github.com/alimy/mir/v5/engine" 11 | ) 12 | 13 | //go:generate go run $GOFILE 14 | func main() { 15 | log.Println("generate code start") 16 | if err := Generate( 17 | UseIris(), 18 | Schema("routes"), 19 | SinkPath("auto"), 20 | WatchCtxDone(true), 21 | RunMode(InSerialMode), 22 | ); err != nil { 23 | log.Fatal(err) 24 | } 25 | log.Println("generate code finish") 26 | } 27 | -------------------------------------------------------------------------------- /mirc/templates/mux/mirc/gen.go.tmpl: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | . "github.com/alimy/mir/v5/core" 10 | . "github.com/alimy/mir/v5/engine" 11 | ) 12 | 13 | //go:generate go run $GOFILE 14 | func main() { 15 | log.Println("generate code start") 16 | if err := Generate( 17 | UseMux(), 18 | Schema("routes"), 19 | SinkPath("auto"), 20 | WatchCtxDone(true), 21 | RunMode(InSerialMode), 22 | ); err != nil { 23 | log.Fatal(err) 24 | } 25 | log.Println("generate code finish") 26 | } 27 | -------------------------------------------------------------------------------- /examples/sail-example/internal/servants/docs/docs_embed.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | //go:build docs 6 | // +build docs 7 | 8 | package docs 9 | 10 | import ( 11 | "github.com/alimy/mir/sail-example/v5/docs/openapi" 12 | "github.com/gin-gonic/gin" 13 | ) 14 | 15 | // RouteDocs register docs asset route 16 | func RouteDocs(e *gin.Engine) { 17 | e.StaticFS("/docs/openapi", openapi.NewFileSystem()) 18 | } 19 | -------------------------------------------------------------------------------- /examples/sail-example/internal/servants/web/site_b.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package web 6 | 7 | import ( 8 | api "github.com/alimy/mir/sail-example/v5/auto/api/v2" 9 | "github.com/alimy/mir/sail-example/v5/internal/servants/base" 10 | ) 11 | 12 | type siteSrvB struct { 13 | base.BaseSrv 14 | api.UnimplementedSiteServant 15 | } 16 | 17 | func newSiteSrvB() api.Site { 18 | return &siteSrvB{} 19 | } 20 | -------------------------------------------------------------------------------- /examples/sail-example/internal/servants/web/site_c.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package web 6 | 7 | import ( 8 | api "github.com/alimy/mir/sail-example/v5/auto/api/v3" 9 | "github.com/alimy/mir/sail-example/v5/internal/servants/base" 10 | ) 11 | 12 | type siteSrvC struct { 13 | base.BaseSrv 14 | api.UnimplementedSiteServant 15 | } 16 | 17 | func newSiteSrvC() api.Site { 18 | return &siteSrvC{} 19 | } 20 | -------------------------------------------------------------------------------- /mirc/templates/hertz/mirc/gen.go.tmpl: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | . "github.com/alimy/mir/v5/core" 10 | . "github.com/alimy/mir/v5/engine" 11 | ) 12 | 13 | //go:generate go run $GOFILE 14 | func main() { 15 | log.Println("generate code start") 16 | if err := Generate( 17 | UseHertz(), 18 | Schema("routes"), 19 | SinkPath("auto"), 20 | WatchCtxDone(true), 21 | RunMode(InSerialMode), 22 | ); err != nil { 23 | log.Fatal(err) 24 | } 25 | log.Println("generate code finish") 26 | } 27 | -------------------------------------------------------------------------------- /mirc/templates/macaron/mirc/gen.go.tmpl: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | . "github.com/alimy/mir/v5/core" 10 | . "github.com/alimy/mir/v5/engine" 11 | ) 12 | 13 | //go:generate go run $GOFILE 14 | func main() { 15 | log.Println("generate code start") 16 | if err := Generate( 17 | UseMacaron(), 18 | Schema("routes"), 19 | SinkPath("auto"), 20 | WatchCtxDone(true), 21 | RunMode(InSerialMode), 22 | ); err != nil { 23 | log.Fatal(err) 24 | } 25 | log.Println("generate code finish") 26 | } 27 | -------------------------------------------------------------------------------- /examples/sail-example/internal/servants/web/admin_a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package web 6 | 7 | import ( 8 | api "github.com/alimy/mir/sail-example/v5/auto/api/v1" 9 | "github.com/alimy/mir/sail-example/v5/internal/servants/base" 10 | ) 11 | 12 | type adminSrvA struct { 13 | base.BaseSrv 14 | api.UnimplementedAdminServant 15 | } 16 | 17 | func newAdminSrvA() api.Admin { 18 | return &adminSrvA{} 19 | } 20 | -------------------------------------------------------------------------------- /examples/sail-example/docs/openapi/embed.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | //go:build docs 6 | // +build docs 7 | 8 | package openapi 9 | 10 | import ( 11 | "embed" 12 | "net/http" 13 | ) 14 | 15 | //go:embed index.html openapi.json **/* 16 | var files embed.FS 17 | 18 | // NewFileSystem get an embed static assets http.FileSystem instance. 19 | func NewFileSystem() http.FileSystem { 20 | return http.FS(files) 21 | } 22 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/mirc/gen.go.tmpl: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | . "github.com/alimy/mir/v5/core" 10 | . "github.com/alimy/mir/v5/engine" 11 | ) 12 | 13 | //go:generate go run $GOFILE 14 | func main() { 15 | log.Println("generate code start") 16 | if err := Generate( 17 | UseHttpRouter(), 18 | Schema("routes"), 19 | SinkPath("auto"), 20 | WatchCtxDone(true), 21 | RunMode(InSerialMode), 22 | ); err != nil { 23 | log.Fatal(err) 24 | } 25 | log.Println("generate code finish") 26 | } 27 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "gomod" 9 | directory: "/examples" 10 | schedule: 11 | interval: "weekly" 12 | reviewers: 13 | - "alimy" 14 | commit-message: 15 | prefix: "mod:" 16 | -------------------------------------------------------------------------------- /examples/mir-example/main.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package main 6 | 7 | import ( 8 | "log" 9 | 10 | "github.com/alimy/mir/mir-example/v5/servants" 11 | "github.com/gin-gonic/gin" 12 | ) 13 | 14 | func main() { 15 | e := gin.Default() 16 | 17 | // register servants to gin 18 | servants.RegisterServants(e) 19 | 20 | // start servant service 21 | if err := e.Run(); err != nil { 22 | log.Fatal(err) 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /mirc/templates/fiber/mirc/gen.go.tmpl: -------------------------------------------------------------------------------- 1 | //go:build generate 2 | // +build generate 3 | 4 | package main 5 | 6 | import ( 7 | "log" 8 | 9 | . "github.com/alimy/mir/v5/core" 10 | . "github.com/alimy/mir/v5/engine" 11 | ) 12 | 13 | //go:generate go run $GOFILE 14 | func main() { 15 | log.Println("generate code start") 16 | if err := Generate( 17 | UseFiber(), 18 | Schema("routes"), 19 | SinkPath("auto"), 20 | NoneQuery(true), 21 | WatchCtxDone(true), 22 | RunMode(InSerialMode), 23 | ); err != nil { 24 | log.Fatal(err) 25 | } 26 | log.Println("generate code finish") 27 | } 28 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/taxonomy.html: -------------------------------------------------------------------------------- 1 | 20 | -------------------------------------------------------------------------------- /examples/sail-example/docs/openapi/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | paopao-ce develop documents 8 | 9 | 13 | 14 | 15 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /mirc/templates/chi/servants/servants.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "github.com/go-chi/chi/v5" 5 | "{{ .PkgName }}/mirc/auto/api" 6 | v1 "{{ .PkgName }}/mirc/auto/api/v1" 7 | v2 "{{ .PkgName }}/mirc/auto/api/v2" 8 | v3 "{{ .PkgName }}/mirc/auto/api/v3" 9 | ) 10 | 11 | // RegisterServants register all the servants tor chi.Route 12 | func RegisterServants(e chi.Router) { 13 | api.RegisterSiteServant(e, newSiteSrv()) 14 | v1.RegisterSiteServant(e, newSiteSrvA(), newSiteChainA()) 15 | v2.RegisterSiteServant(e, newSiteSrvB()) 16 | v3.RegisterSiteServant(e, newSiteSrvC()) 17 | } 18 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/tabs.html: -------------------------------------------------------------------------------- 1 | {{ if .Inner }}{{ end }} 2 | {{ $id := .Get 0 }} 3 | {{ $group := printf "tabs-%s" $id }} 4 | 5 |
6 | {{- range $index, $tab := .Scratch.Get $group -}} 7 | 8 | 11 |
12 | {{- .Content | $.Page.RenderString -}} 13 |
14 | {{- end -}} 15 |
16 | -------------------------------------------------------------------------------- /mirc/templates/httprouter/servants/servants.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "github.com/julienschmidt/httprouter" 5 | "{{ .PkgName }}/mirc/auto/api" 6 | v1 "{{ .PkgName }}/mirc/auto/api/v1" 7 | v2 "{{ .PkgName }}/mirc/auto/api/v2" 8 | v3 "{{ .PkgName }}/mirc/auto/api/v3" 9 | ) 10 | 11 | // RegisterServants register all the servants to httprouter.Router 12 | func RegisterServants(e *httprouter.Router) { 13 | api.RegisterSiteServant(e, newSiteSrv()) 14 | v1.RegisterSiteServant(e, newSiteSrvA()) 15 | v2.RegisterSiteServant(e, newSiteSrvB()) 16 | v3.RegisterSiteServant(e, newSiteSrvC()) 17 | } 18 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/content.en/docs/shortcodes/details.md: -------------------------------------------------------------------------------- 1 | # Details 2 | 3 | Details shortcode is a helper for `details` html5 element. It is going to replace `expand` shortcode. 4 | 5 | ## Example 6 | ```tpl 7 | {{}} 8 | ## Markdown content 9 | Lorem markdownum insigne... 10 | {{}} 11 | ``` 12 | ```tpl 13 | {{}} 14 | ## Markdown content 15 | Lorem markdownum insigne... 16 | {{}} 17 | ``` 18 | 19 | {{< details "Title" open >}} 20 | ## Markdown content 21 | Lorem markdownum insigne... 22 | {{< /details >}} 23 | -------------------------------------------------------------------------------- /engine/engine_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package engine 6 | 7 | import ( 8 | "testing" 9 | 10 | "github.com/alimy/mir/v5/core" 11 | ) 12 | 13 | func TestGenerate(t *testing.T) { 14 | if err := Generate(core.WithEntry(nil)); err == nil { 15 | t.Error("want an error but not") 16 | } 17 | AddEntry(nil) 18 | AddEntry(nil, nil) 19 | if len(mirEntries) != 4 { 20 | t.Errorf("want mirEntries's size is 4 but is %d", len(mirEntries)) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /examples/sail-example/internal/servants/bot/user.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package bot 6 | 7 | import ( 8 | api "github.com/alimy/mir/sail-example/v5/auto/api/bot/v1" 9 | "github.com/alimy/mir/sail-example/v5/internal/servants/base" 10 | ) 11 | 12 | var ( 13 | _ api.User = (*userSrv)(nil) 14 | ) 15 | 16 | type userSrv struct { 17 | base.BaseSrv 18 | api.UnimplementedUserServant 19 | } 20 | 21 | func newUserSrv() api.User { 22 | return &userSrv{} 23 | } 24 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/posts/list.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 | {{ range sort .Paginator.Pages }} 3 | 15 | {{ end }} 16 | 17 | {{ template "_internal/pagination.html" . }} 18 | {{ end }} 19 | 20 | {{ define "toc" }} 21 | {{ partial "docs/taxonomy" . }} 22 | {{ end }} 23 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/taxonomy/taxonomy.html: -------------------------------------------------------------------------------- 1 | {{ define "main" }} 2 | {{ range sort .Paginator.Pages }} 3 | 15 | {{ end }} 16 | 17 | {{ template "_internal/pagination.html" . }} 18 | {{ end }} 19 | 20 | {{ define "toc" }} 21 | {{ partial "docs/taxonomy" . }} 22 | {{ end }} 23 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0010_user_following.up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE `p_following` ( 2 | `id` bigint unsigned NOT NULL AUTO_INCREMENT, 3 | `user_id` bigint unsigned NOT NULL, 4 | `follow_id` bigint unsigned NOT NULL, 5 | `is_del` tinyint NOT NULL DEFAULT 0, -- 是否删除, 0否, 1是 6 | `created_on` bigint unsigned NOT NULL DEFAULT '0', 7 | `modified_on` bigint unsigned NOT NULL DEFAULT '0', 8 | `deleted_on` bigint unsigned NOT NULL DEFAULT '0', 9 | PRIMARY KEY (`id`) USING BTREE, 10 | KEY `idx_following_user_follow` (`user_id`,`follow_id`) USING BTREE 11 | ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci; 12 | -------------------------------------------------------------------------------- /engine/internal/help.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package internal 6 | 7 | import ( 8 | "path" 9 | "strings" 10 | ) 11 | 12 | func anyPathPatterns(schemaPath []string) (res []string) { 13 | var cpath string 14 | for _, it := range schemaPath { 15 | cpath = path.Clean(it) 16 | if !path.IsAbs(cpath) && !strings.HasPrefix(cpath, "./") && !strings.HasPrefix(cpath, "../") { 17 | cpath = "./" + cpath 18 | } 19 | res = append(res, cpath+"/...") 20 | } 21 | return 22 | } 23 | -------------------------------------------------------------------------------- /go.sum: -------------------------------------------------------------------------------- 1 | github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= 2 | github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= 3 | golang.org/x/mod v0.27.0 h1:kb+q2PyFnEADO2IEF935ehFUXlWiNjJWtRNgBLSfbxQ= 4 | golang.org/x/mod v0.27.0/go.mod h1:rWI627Fq0DEoudcK+MBkNkCe0EetEaDSwJJkCcjpazc= 5 | golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw= 6 | golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA= 7 | golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= 8 | golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= 9 | -------------------------------------------------------------------------------- /mirc/templates/gin/servants/servants.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "github.com/gin-gonic/gin" 5 | "{{ .PkgName }}/mirc/auto/api" 6 | v1 "{{ .PkgName }}/mirc/auto/api/v1" 7 | v2 "{{ .PkgName }}/mirc/auto/api/v2" 8 | v3 "{{ .PkgName }}/mirc/auto/api/v3" 9 | ) 10 | 11 | // RegisterServants register all the servants to gin.Engine 12 | func RegisterServants(e *gin.Engine) { 13 | api.RegisterSiteServant(e, newSiteSrv()) 14 | v1.RegisterAdminServant(e, newAdminSrvA()) 15 | v1.RegisterSiteServant(e, newSiteSrvA(), newSiteChainA()) 16 | v2.RegisterSiteServant(e, newSiteSrvB()) 17 | v3.RegisterSiteServant(e, newSiteSrvC()) 18 | } 19 | -------------------------------------------------------------------------------- /examples/mir-example/servants/site_a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package servants 6 | 7 | import ( 8 | api "github.com/alimy/mir/mir-example/v5/mirc/auto/api/v1" 9 | ) 10 | 11 | type siteSrvA struct { 12 | baseSrv 13 | 14 | api.UnimplementedSiteServant 15 | } 16 | 17 | type siteChainA struct { 18 | api.UnimplementedSiteChain 19 | } 20 | 21 | func newSiteSrvA() api.Site { 22 | return &siteSrvA{} 23 | } 24 | 25 | func newSiteChainA() api.SiteChain { 26 | return &siteChainA{} 27 | } 28 | -------------------------------------------------------------------------------- /internal/internal_test.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package internal 6 | 7 | import ( 8 | "errors" 9 | "testing" 10 | ) 11 | 12 | func TestMirCtx(t *testing.T) { 13 | ctx := NewMirCtx(10) 14 | if ctx.Capcity() != 10 { 15 | t.Error("want capcity is 10 but not") 16 | } 17 | ctx.Cancel(errors.New("just an error")) 18 | ctx.Cancel(errors.New("another error")) 19 | if err := ctx.Err(); err != nil && err.Error() != "just an error" { 20 | t.Error("want 'just an error' but not") 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /mirc/templates/hertz/servants/servants.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "github.com/cloudwego/hertz/pkg/route" 5 | "{{ .PkgName }}/mirc/auto/api" 6 | v1 "{{ .PkgName }}/mirc/auto/api/v1" 7 | v2 "{{ .PkgName }}/mirc/auto/api/v2" 8 | v3 "{{ .PkgName }}/mirc/auto/api/v3" 9 | ) 10 | 11 | // RegisterServants register all the servants to gin.Engine 12 | func RegisterServants(e *route.Engine) { 13 | api.RegisterSiteServant(e, newSiteSrv()) 14 | v1.RegisterAdminServant(e, newAdminSrvA()) 15 | v1.RegisterSiteServant(e, newSiteSrvA(), newSiteChainA()) 16 | v2.RegisterSiteServant(e, newSiteSrvB()) 17 | v3.RegisterSiteServant(e, newSiteSrvC()) 18 | } 19 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/shortcodes/katex.html: -------------------------------------------------------------------------------- 1 | {{- if not (.Page.Scratch.Get "katex") -}} 2 | 3 | 4 | 5 | 6 | {{- .Page.Scratch.Set "katex" true -}} 7 | {{- end -}} 8 | 9 | 10 | {{ cond (in .Params "display") "\\[" "\\(" -}} 11 | {{- trim .Inner "\n" -}} 12 | {{- cond (in .Params "display") "\\]" "\\)" }} 13 | 14 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/exampleSite/content.en/docs/example/collapsed/3rd-level/4th-level.md: -------------------------------------------------------------------------------- 1 | # 4th Level of Menu 2 | 3 | ## Caesorum illa tu sentit micat vestes papyriferi 4 | 5 | Inde aderam facti; Theseus vis de tauri illa peream. Oculos **uberaque** non 6 | regisque vobis cursuque, opus venit quam vulnera. Et maiora necemque, lege modo; 7 | gestanda nitidi, vero? Dum ne pectoraque testantur. 8 | 9 | Venasque repulsa Samos qui, exspectatum eram animosque hinc, [aut 10 | manes](http://www.creveratnon.net/apricaaetheriis), Assyrii. Cupiens auctoribus 11 | pariter rubet, profana magni super nocens. Vos ius sibilat inpar turba visae 12 | iusto! Sedes ante dum superest **extrema**. 13 | -------------------------------------------------------------------------------- /mirc/templates/echo/servants/core.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "errors" 5 | "net/http" 6 | 7 | "github.com/alimy/mir/v5" 8 | "github.com/labstack/echo/v4" 9 | ) 10 | 11 | type baseSrv struct{} 12 | 13 | func (baseSrv) Bind(c echo.Context, obj any) error { 14 | return mir.NewError(http.StatusNotImplemented, errors.New("method not implemented")) 15 | } 16 | 17 | func (baseSrv) Render(c echo.Context, data any, err error) { 18 | if err == nil { 19 | c.JSON(http.StatusOK, data) 20 | } else if code, ok := mir.HttpStatusCode(err); ok { 21 | c.String(code, err.Error()) 22 | } else { 23 | c.String(http.StatusInternalServerError, err.Error()) 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /mirc/templates/gin/servants/core.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "net/http" 5 | 6 | "github.com/alimy/mir/v5" 7 | "github.com/gin-gonic/gin" 8 | ) 9 | 10 | type baseSrv struct{} 11 | 12 | func (baseSrv) Bind(c *gin.Context, obj any) error { 13 | if err := c.ShouldBind(obj); err != nil { 14 | mir.NewError(http.StatusBadRequest, err) 15 | } 16 | return nil 17 | } 18 | 19 | func (baseSrv) Render(c *gin.Context, data any, err error) { 20 | if err == nil { 21 | c.JSON(http.StatusOK, data) 22 | } else if code, ok := mir.HttpStatusCode(err); ok { 23 | c.JSON(code, err.Error()) 24 | } else { 25 | c.JSON(http.StatusInternalServerError, err.Error()) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/mysql/0001_initialize_schema.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS `p_attachment`; 2 | DROP TABLE IF EXISTS `p_captcha`; 3 | DROP TABLE IF EXISTS `p_comment`; 4 | DROP TABLE IF EXISTS `p_comment_content`; 5 | DROP TABLE IF EXISTS `p_comment_reply`; 6 | DROP TABLE IF EXISTS `p_message`; 7 | DROP TABLE IF EXISTS `p_post`; 8 | DROP TABLE IF EXISTS `p_post_attachment_bill`; 9 | DROP TABLE IF EXISTS `p_post_collection`; 10 | DROP TABLE IF EXISTS `p_post_content`; 11 | DROP TABLE IF EXISTS `p_post_star`; 12 | DROP TABLE IF EXISTS `p_tag`; 13 | DROP TABLE IF EXISTS `p_user`; 14 | DROP TABLE IF EXISTS `p_wallet_recharge`; 15 | DROP TABLE IF EXISTS `p_wallet_statement`; 16 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0001_initialize_schema.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS "p_attachment"; 2 | DROP TABLE IF EXISTS "p_captcha"; 3 | DROP TABLE IF EXISTS "p_comment"; 4 | DROP TABLE IF EXISTS "p_comment_content"; 5 | DROP TABLE IF EXISTS "p_comment_reply"; 6 | DROP TABLE IF EXISTS "p_message"; 7 | DROP TABLE IF EXISTS "p_post"; 8 | DROP TABLE IF EXISTS "p_post_attachment_bill"; 9 | DROP TABLE IF EXISTS "p_post_collection"; 10 | DROP TABLE IF EXISTS "p_post_content"; 11 | DROP TABLE IF EXISTS "p_post_star"; 12 | DROP TABLE IF EXISTS "p_tag"; 13 | DROP TABLE IF EXISTS "p_user"; 14 | DROP TABLE IF EXISTS "p_wallet_recharge"; 15 | DROP TABLE IF EXISTS "p_wallet_statement"; 16 | -------------------------------------------------------------------------------- /docs/content.en/docs/tutorials/interface-define.md: -------------------------------------------------------------------------------- 1 | --- 2 | weight: 21 3 | title: "Interface Define" 4 | --- 5 | 6 | ## Interface Define 7 | ```go 8 | // file: mirc/routes.go 9 | 10 | package routes 11 | 12 | import ( 13 | . "github.com/alimy/mir/v5" 14 | ) 15 | 16 | type LoginReq struct { 17 | Name string `json:"name"` 18 | Passwd string `json:"passwd"` 19 | } 20 | 21 | type LoginResp struct { 22 | JwtToken string `json:"jwt_token"` 23 | } 24 | 25 | // User user interface info 26 | type User struct { 27 | Schema `mir:"v1,chain"` 28 | Login func(Post, LoginReq) LoginResp `mir:"/login/"` 29 | Logout func(Post) `mir:"/logout/"` 30 | } 31 | ``` -------------------------------------------------------------------------------- /docs/themes/hugo-book/theme.toml: -------------------------------------------------------------------------------- 1 | # theme.toml template for a Hugo theme 2 | # See https://github.com/gohugoio/hugoThemes#themetoml for an example 3 | 4 | name = "Book" 5 | license = "MIT" 6 | licenselink = "https://github.com/alex-shpak/hugo-book/blob/master/LICENSE" 7 | description = "Hugo documentation theme as simple as plain book" 8 | homepage = "https://github.com/alex-shpak/hugo-book" 9 | demosite = "https://hugo-book-demo.netlify.app" 10 | tags = ["responsive", "clean", "documentation", "docs", "flexbox", "search", "mobile", "multilingual", "disqus"] 11 | features = [] 12 | min_version = "0.68" 13 | 14 | [author] 15 | name = "Alex Shpak" 16 | homepage = "https://github.com/alex-shpak/" 17 | -------------------------------------------------------------------------------- /mirc/templates/hertz/servants/core.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "context" 5 | "net/http" 6 | 7 | "github.com/alimy/mir/v5" 8 | "github.com/cloudwego/hertz/pkg/app" 9 | ) 10 | 11 | type baseSrv struct{} 12 | 13 | func (baseSrv) Bind(c context.Context, ctx *app.RequestContext, obj any) error { 14 | // do something 15 | return nil 16 | } 17 | 18 | func (baseSrv) Render(c context.Context, ctx *app.RequestContext, data any, err error) { 19 | if err == nil { 20 | ctx.JSON(http.StatusOK, data) 21 | } else if code, ok := mir.HttpStatusCode(err); ok { 22 | ctx.JSON(code, err.Error()) 23 | } else { 24 | ctx.JSON(http.StatusInternalServerError, err.Error()) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /examples/sail-example/cmd/version.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package cmd 6 | 7 | import ( 8 | "fmt" 9 | 10 | "github.com/alimy/mir/sail-example/v5/internal/conf" 11 | "github.com/spf13/cobra" 12 | ) 13 | 14 | func init() { 15 | versionCmd := &cobra.Command{ 16 | Use: "version", 17 | Short: "show version information", 18 | Long: "show version information", 19 | Run: versionRun, 20 | } 21 | Register(versionCmd) 22 | } 23 | 24 | func versionRun(_cmd *cobra.Command, _args []string) { 25 | fmt.Println(conf.VersionInfo()) 26 | } 27 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0001_initialize_schema.down.sql: -------------------------------------------------------------------------------- 1 | DROP TABLE IF EXISTS p_attachment; 2 | DROP TABLE IF EXISTS p_captcha; 3 | DROP TABLE IF EXISTS p_comment; 4 | DROP TABLE IF EXISTS p_comment_content; 5 | DROP TABLE IF EXISTS p_comment_reply; 6 | DROP TABLE IF EXISTS p_message; 7 | DROP TABLE IF EXISTS p_post; 8 | DROP TABLE IF EXISTS p_post_attachment_bill; 9 | DROP TABLE IF EXISTS p_post_collection; 10 | DROP TABLE IF EXISTS p_post_content; 11 | DROP TABLE IF EXISTS p_post_star; 12 | DROP TABLE IF EXISTS p_tag; 13 | DROP TABLE IF EXISTS p_user; 14 | DROP TABLE IF EXISTS p_wallet_recharge; 15 | DROP TABLE IF EXISTS p_wallet_statement; 16 | DROP SEQUENCE IF EXISTS post_id_seq; 17 | -------------------------------------------------------------------------------- /examples/sail-example/internal/servants/web/site_a.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package web 6 | 7 | import ( 8 | api "github.com/alimy/mir/sail-example/v5/auto/api/v1" 9 | "github.com/alimy/mir/sail-example/v5/internal/servants/base" 10 | ) 11 | 12 | type siteSrvA struct { 13 | base.BaseSrv 14 | api.UnimplementedSiteServant 15 | } 16 | 17 | type siteChainA struct { 18 | api.UnimplementedSiteChain 19 | } 20 | 21 | func newSiteSrvA() api.Site { 22 | return &siteSrvA{} 23 | } 24 | 25 | func newSiteChainA() api.SiteChain { 26 | return &siteChainA{} 27 | } 28 | -------------------------------------------------------------------------------- /examples/sail-example/pkg/types/types.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package types 6 | 7 | const ( 8 | // No 二态值 否 9 | No int8 = 0 10 | 11 | // Yes 二态值 是 12 | Yes int8 = 1 13 | ) 14 | 15 | // Empty empty alias type 16 | type Empty = struct{} 17 | 18 | // Fn empty argument func alias type 19 | type Fn = func() 20 | 21 | // Boxes Box/Unbox interface 22 | type Boxes[T any] interface { 23 | Box(t T) 24 | Unbox() T 25 | } 26 | 27 | type Integer interface { 28 | ~int8 | ~int16 | ~int32 | ~int64 | ~uint8 | ~uint16 | ~uint32 | ~uint64 | ~int | ~uint 29 | } 30 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/clipboard.js: -------------------------------------------------------------------------------- 1 | (function () { 2 | function select(element) { 3 | const selection = window.getSelection(); 4 | 5 | const range = document.createRange(); 6 | range.selectNodeContents(element); 7 | 8 | selection.removeAllRanges(); 9 | selection.addRange(range); 10 | } 11 | 12 | document.querySelectorAll("pre code").forEach(code => { 13 | code.addEventListener("click", function (event) { 14 | if (window.getSelection().toString()) { 15 | return; 16 | } 17 | select(code.parentElement); 18 | 19 | if (navigator.clipboard) { 20 | navigator.clipboard.writeText(code.parentElement.textContent); 21 | } 22 | }); 23 | }); 24 | })(); 25 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/post-meta.html: -------------------------------------------------------------------------------- 1 | {{ with .Date }} 2 |
{{ partial "docs/date" (dict "Date" . "Format" $.Site.Params.BookDateFormat) }}
3 | {{ end }} 4 | 5 | {{ range $taxonomy, $_ := .Site.Taxonomies }} 6 | {{ with $terms := $.GetTerms $taxonomy }} 7 |
8 | {{ range $n, $term := $terms }}{{ if $n }}, {{ end }} 9 | {{ $term.Title }} 10 | {{- end }} 11 |
12 | {{ end }} 13 | {{ end }} 14 | 15 | {{ if .Params.image }} 16 |

17 | {{ with .Resources.GetMatch .Params.image }} 18 | 19 | {{ else }} 20 | 21 | {{ end }} 22 |

23 | {{ end }} 24 | -------------------------------------------------------------------------------- /examples/sail-example/pkg/utils/str.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package utils 6 | 7 | import ( 8 | "unsafe" 9 | ) 10 | 11 | // String convert bytes to string 12 | func String(data []byte) (res string) { 13 | if size := len(data); size > 0 { 14 | res = unsafe.String(unsafe.SliceData(data), size) 15 | } 16 | return 17 | } 18 | 19 | // Bytes convert string to []byte 20 | func Bytes(data string) (res []byte) { 21 | if size := len(data); size > 0 { 22 | res = unsafe.Slice(unsafe.StringData(data), size) 23 | } else { 24 | res = []byte{} 25 | } 26 | return 27 | } 28 | -------------------------------------------------------------------------------- /mirc/templates/chi/servants/core.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "errors" 5 | "net/http" 6 | 7 | "github.com/alimy/mir/v5" 8 | ) 9 | 10 | type baseSrv struct{} 11 | 12 | func (baseSrv) Bind(r *http.Request, obj any) error { 13 | return mir.NewError(http.StatusNotImplemented, errors.New("not implemented")) 14 | } 15 | 16 | func (baseSrv) Render(w http.ResponseWriter, data any, err error) { 17 | if err == nil { 18 | w.WriteHeader(http.StatusOK) 19 | w.Write([]byte("method not implemented to mashal data")) 20 | } else if code, ok := mir.HttpStatusCode(err); ok { 21 | w.WriteHeader(code) 22 | w.Write([]byte(err.Error())) 23 | } else { 24 | w.WriteHeader(http.StatusInternalServerError) 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /service/http_server.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package service 6 | 7 | import ( 8 | "context" 9 | "net/http" 10 | ) 11 | 12 | var ( 13 | _ server = (*httpServer[*http.ServeMux])(nil) 14 | ) 15 | 16 | // httpServer wraper for gin.engine and http.Server 17 | type httpServer[T http.Handler] struct { 18 | *baseServer 19 | 20 | e T 21 | server *http.Server 22 | } 23 | 24 | func (s *httpServer[T]) start() error { 25 | return s.server.ListenAndServe() 26 | } 27 | 28 | func (s *httpServer[T]) stop() error { 29 | return s.server.Shutdown(context.Background()) 30 | } 31 | -------------------------------------------------------------------------------- /mirc/templates/fiber/servants/core.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "errors" 5 | "net/http" 6 | 7 | "github.com/alimy/mir/v5" 8 | "github.com/gofiber/fiber/v2" 9 | ) 10 | 11 | type baseSrv struct{} 12 | 13 | func (baseSrv) Bind(c *fiber.Ctx, obj any) error { 14 | return mir.NewError(http.StatusNotImplemented, errors.New("method not implemented")) 15 | } 16 | 17 | func (baseSrv) Render(c *fiber.Ctx, data any, err error) { 18 | if err == nil { 19 | c.Status(http.StatusOK) 20 | c.JSON(data) 21 | } else if code, ok := mir.HttpStatusCode(err); ok { 22 | c.Status(code) 23 | c.Write([]byte(err.Error())) 24 | } else { 25 | c.Status(http.StatusInternalServerError) 26 | c.Write([]byte(err.Error())) 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/postgres/0005_topic_follow.up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE p_topic_user ( 2 | ID BIGSERIAL PRIMARY KEY, 3 | topic_id BIGINT NOT NULL,-- 标签ID 4 | user_id BIGINT NOT NULL,-- 创建者ID 5 | alias_name VARCHAR ( 255 ),-- 别名 6 | remark VARCHAR ( 512 ),-- 备注 7 | quote_num BIGINT,-- 引用数 8 | is_top SMALLINT NOT NULL DEFAULT 0,-- 是否置顶 0 为未置顶、1 为已置顶 9 | created_on BIGINT NOT NULL DEFAULT 0,-- 创建时间 10 | modified_on BIGINT NOT NULL DEFAULT 0,-- 修改时间 11 | deleted_on BIGINT NOT NULL DEFAULT 0,-- 删除时间 12 | is_del SMALLINT NOT NULL DEFAULT 0,-- 是否删除 0 为未删除、1 为已删除 13 | reserve_a VARCHAR ( 255 ),-- 保留字段a 14 | reserve_b VARCHAR ( 255 ) -- 保留字段b 15 | ); 16 | CREATE UNIQUE INDEX idx_topic_user_uid_tid ON p_topic_user USING btree ( topic_id, user_id ); -------------------------------------------------------------------------------- /examples/sail-example/scripts/migration/sqlite3/0006_topic_follow.up.sql: -------------------------------------------------------------------------------- 1 | CREATE TABLE "p_topic_user" ( 2 | "id" integer, 3 | "topic_id" integer NOT NULL,-- 标签ID 4 | "user_id" integer NOT NULL,-- 创建者ID 5 | "alias_name" text ( 255 ),-- 别名 6 | "remark" text ( 512 ),-- 备注 7 | "quote_num" integer,-- 引用数 8 | "is_top" integer NOT NULL DEFAULT 0,-- 是否置顶 0 为未置顶、1 为已置顶 9 | "created_on" integer NOT NULL DEFAULT 0,-- 创建时间 10 | "modified_on" integer NOT NULL DEFAULT 0,-- 修改时间 11 | "deleted_on" integer NOT NULL DEFAULT 0,-- 删除时间 12 | "is_del" integer NOT NULL DEFAULT 0,-- 是否删除 0 为未删除、1 为已删除 13 | "reserve_a" text,-- 保留字段a 14 | "reserve_b" text,-- 保留字段b 15 | PRIMARY KEY ( "id" ) 16 | ); 17 | CREATE UNIQUE INDEX "idx_topic_user_uid_tid" ON "p_topic_user" ( "topic_id", "user_id" ); -------------------------------------------------------------------------------- /mirc/templates/mux/servants/core.go.tmpl: -------------------------------------------------------------------------------- 1 | package servants 2 | 3 | import ( 4 | "errors" 5 | "net/http" 6 | 7 | "github.com/alimy/mir/v5" 8 | ) 9 | 10 | type baseSrv struct{} 11 | 12 | func (baseSrv) Bind(r *http.Request, obj any) error { 13 | return mir.NewError(http.StatusNotImplemented, errors.New("method not implemented")) 14 | } 15 | 16 | func (baseSrv) Render(w http.ResponseWriter, data any, err error) { 17 | if err == nil { 18 | w.WriteHeader(http.StatusNotImplemented) 19 | w.Write([]byte("method not implemented")) 20 | } else if code, ok := mir.HttpStatusCode(err); ok { 21 | w.WriteHeader(code) 22 | w.Write([]byte(err.Error())) 23 | } else { 24 | w.WriteHeader(http.StatusInternalServerError) 25 | w.Write([]byte(err.Error())) 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /examples/mir-example/mirc/gen.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | //go:build generate 6 | // +build generate 7 | 8 | package main 9 | 10 | import ( 11 | "log" 12 | 13 | . "github.com/alimy/mir/v5/core" 14 | . "github.com/alimy/mir/v5/engine" 15 | ) 16 | 17 | //go:generate go run $GOFILE 18 | func main() { 19 | log.Println("generate code start") 20 | if err := Generate( 21 | UseGin(), 22 | Schema("routes"), 23 | SinkPath("auto"), 24 | UseRequestContext(), 25 | WatchCtxDone(true), 26 | RunMode(InSerialMode), 27 | ); err != nil { 28 | log.Fatal(err) 29 | } 30 | log.Println("generate code finish") 31 | } 32 | -------------------------------------------------------------------------------- /examples/sail-example/mirc/gen.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | //go:build generate 6 | // +build generate 7 | 8 | package main 9 | 10 | import ( 11 | "log" 12 | 13 | . "github.com/alimy/mir/v5/core" 14 | . "github.com/alimy/mir/v5/engine" 15 | ) 16 | 17 | //go:generate go run $GOFILE 18 | func main() { 19 | log.Println("generate code start") 20 | if err := Generate( 21 | UseGin(), 22 | Schema("web", "bot"), 23 | SinkPath("../auto"), 24 | UseRequestContext(), 25 | WatchCtxDone(true), 26 | RunMode(InSerialMode), 27 | ); err != nil { 28 | log.Fatal(err) 29 | } 30 | log.Println("generate code finish") 31 | } 32 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/assets/search-data.json: -------------------------------------------------------------------------------- 1 | [ 2 | {{- $pages := where .Site.Pages "Kind" "in" (slice "page" "section") -}} 3 | {{- $pages = where $pages "Params.booksearchexclude" "!=" true -}} 4 | {{/* Remove until we know why it does not work, see https://github.com/alex-shpak/hugo-book/issues/528 */}} 5 | {{/*- $pages = where $pages "Content" "not in" (slice nil "") -*/}} 6 | {{- $pages = where $pages "Content" "!=" "" -}} 7 | 8 | {{ range $index, $page := $pages }} 9 | {{ if gt $index 0}},{{end}} { 10 | "id": {{ $index }}, 11 | "href": "{{ $page.RelPermalink }}", 12 | "title": {{ (partial "docs/title" $page) | jsonify }}, 13 | "section": {{ (partial "docs/title" $page.Parent) | jsonify }}, 14 | "content": {{ $page.Plain | jsonify }} 15 | } 16 | {{- end -}} 17 | ] 18 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | GOFMT ?= gofmt -s -w 2 | GOFILES := $(shell find . -name "*.go" -type f) 3 | 4 | .PHONY: default 5 | default: ci 6 | 7 | .PHONY: ci 8 | ci: vet 9 | go test ./... 10 | 11 | .PHONY: test 12 | test: 13 | go test ./... 14 | 15 | .PHONY: gen-docs 16 | gen-docs: 17 | @-rm -rf docs/public 18 | @cd docs && hugo --minify --baseURL "https://alimy.github.io/mir/" && cd - 19 | 20 | .PHONY: run-docs 21 | run-docs: 22 | @cd docs && hugo serve --minify && cd - 23 | 24 | .PHONY: vet 25 | vet: 26 | go vet ./... 27 | 28 | .PHONY: fmt-check 29 | fmt-check: 30 | @diff=$$($(GOFMT) -d $(GOFILES)); \ 31 | if [ -n "$$diff" ]; then \ 32 | echo "Please run 'make fmt' and commit the result:"; \ 33 | echo "$${diff}"; \ 34 | exit 1; \ 35 | fi; 36 | 37 | .PHONY: fmt 38 | fmt: 39 | $(GOFMT) $(GOFILES) 40 | -------------------------------------------------------------------------------- /examples/sail-example/Dockerfile: -------------------------------------------------------------------------------- 1 | # syntax=docker/dockerfile:1 2 | 3 | FROM golang:1.22-alpine3.18 AS builder 4 | ENV GOPROXY=https://goproxy.io,direct 5 | 6 | WORKDIR /app/examples 7 | ADD . . 8 | RUN --mount=type=cache,target=$GOPATH/pkg,id=examples-gomodcache \ 9 | --mount=type=cache,target=/root/.cache/go-build,id=examples-gocache \ 10 | go mod download && go build -trimpath -tags 'go_json' -ldflags '-w -s' -o examples 11 | 12 | FROM alpine:3.18 13 | WORKDIR /app/examples 14 | COPY --from=builder /app/examples/examples . 15 | COPY --from=builder /app/examples/config.yaml . 16 | 17 | VOLUME ["/app/paopao-ce/custom"] 18 | EXPOSE 8080 8081 8082 19 | HEALTHCHECK --interval=5s --timeout=3s --retries=3 CMD ps -ef | grep examples || exit 1 20 | 21 | ENTRYPOINT ["/app/examples"] 22 | CMD ["serve"] 23 | -------------------------------------------------------------------------------- /docs/themes/hugo-book/layouts/partials/docs/menu-hugo.html: -------------------------------------------------------------------------------- 1 | 5 | {{ if . }} 6 | {{ template "book-menu-hugo" . }} 7 | {{ end }} 8 | 9 | {{ define "book-menu-hugo" }} 10 | 28 | {{ end }} 29 | -------------------------------------------------------------------------------- /examples/sail-example/cmd/migrate/migrate.go: -------------------------------------------------------------------------------- 1 | // Copyright 2025 Michael Li . All rights reserved. 2 | // Use of this source code is governed by Apache License 2.0 that 3 | // can be found in the LICENSE file. 4 | 5 | package migrate 6 | 7 | import ( 8 | "fmt" 9 | 10 | "github.com/alimy/mir/sail-example/v5/cmd" 11 | "github.com/spf13/cobra" 12 | ) 13 | 14 | func init() { 15 | migrateCmd := &cobra.Command{ 16 | Use: "migrate", 17 | Short: "migrate database data", 18 | Long: "miegrate database data when mir-examples upgrade", 19 | Run: migrateRun, 20 | } 21 | cmd.Register(migrateCmd) 22 | } 23 | 24 | func migrateRun(_cmd *cobra.Command, _args []string) { 25 | // TODO: add some logic for migrate cmd feature 26 | fmt.Println("sorry, this feature is not implemented yet.") 27 | } 28 | --------------------------------------------------------------------------------