From 4fce2a2ddcb04693a6f9390ba19f10cf761321e9 Mon Sep 17 00:00:00 2001 From: Samuel Berthe Date: Mon, 4 Dec 2023 04:08:35 +0100 Subject: [PATCH] more doc --- README.md | 20 ++++++++-------- docs/docs/about.md | 50 ++++++++++++++++++++++++++++++++++++++++ docs/src/pages/index.tsx | 7 ++++++ 3 files changed, 67 insertions(+), 10 deletions(-) create mode 100644 docs/docs/about.md diff --git a/README.md b/README.md index 0d19481..06ecd8c 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ This library implements the Dependency Injection design pattern. It may replace **Why this name?** -I love the **short name** for such a utility library. This name is the sum of `DI` and `Go` and no Go package currently uses this name. +I love the **short name** for such a utility library. This name is the sum of `DI` and `Go` and no Go package uses this name. ## 🔥 Migration from v1 to v2 @@ -28,31 +28,31 @@ I love the **short name** for such a utility library. This name is the sum of `D ## 💡 Features -- Service registration: +- **📒 Service registration** - By type inference - By name -- Service invocation +- **🪃 Service invocation** - Eager loading - Lazy loading - Transient loading -- Service aliasing +- **🧙‍♂️ Service aliasing** - Implicit (provide struct, invoke interface) - Explicit (provide struct, bind interface, invoke interface) -- Service lifecycle: +- **🔁 Service lifecycle** - Health check - Graceful unload (shutdown) - Lifecycle hooks -- Scope (a.k.a module) tree +- **📦 Scope (a.k.a module) tree** - Visibility control - Dependency grouping -- Injector +- **📤 Injector** - Dependency graph resolution and visualization - Default injector - Injector cloning - Service override -- Lightweight, no dependencies -- No code generation -- Typesafe API +- **🌈 Lightweight, no dependencies** +- **🔅 No code generation** +- **😷 Typesafe API** ## 🚀 Install diff --git a/docs/docs/about.md b/docs/docs/about.md new file mode 100644 index 0000000..f4bd2dc --- /dev/null +++ b/docs/docs/about.md @@ -0,0 +1,50 @@ +--- +title: ✌️ About +description: Discover "do", the dependency injection toolkit for Go +sidebar_position: 0 +--- + +# ✌️ About + +**⚙️ A dependency injection toolkit based on Go 1.18+ Generics.** + +This library implements the Dependency Injection design pattern. It may replace the `uber/dig` fantastic package. `samber/do` uses Go 1.18+ generics instead of reflection and therefore offers a typesafe API. + +**See also:** + +- [samber/lo](https://github.com/samber/lo): A Lodash-style Go library based on Go 1.18+ Generics +- [samber/mo](https://github.com/samber/mo): Monads based on Go 1.18+ Generics (Option, Result, Either...) + +**Why this name?** + +I love the **short name** for such a utility library. This name is the sum of `DI` and `Go` and no Go package uses this name. + +## 💡 Features + +`samber/do` is built with high attention to the developer and contributor experience. + +- **📒 Service registration** + - By type inference + - By name +- **🪃 Service invocation** + - Eager loading + - Lazy loading + - Transient loading +- **🧙‍♂️ Service aliasing** + - Implicit (provide struct, invoke interface) + - Explicit (provide struct, bind interface, invoke interface) +- **🔁 Service lifecycle** + - Health check + - Graceful unload (shutdown) + - Lifecycle hooks +- **📦 Scope (a.k.a module) tree** + - Visibility control + - Dependency grouping +- **📤 Injector** + - Dependency graph resolution and visualization + - Default injector + - Injector cloning + - Service override +- **🌈 Lightweight, no dependencies** +- **🔅 No code generation** +- **😷 Typesafe API** diff --git a/docs/src/pages/index.tsx b/docs/src/pages/index.tsx index ed1586a..b9ab1bf 100644 --- a/docs/src/pages/index.tsx +++ b/docs/src/pages/index.tsx @@ -16,6 +16,13 @@ function HomepageHeader() { {siteConfig.title}

{siteConfig.tagline}

+
+ + Intro + +