diff --git a/README.md b/README.md index be843f1..633ae9c 100644 --- a/README.md +++ b/README.md @@ -78,8 +78,7 @@ import ( func main(){ - db := capsule.New().AddConn("primary", - "postgres", + db := capsule.New().AddConn("primary", "postgres", "postgres://postgres:123456@127.0.0.1/xun?sslmode=disable&search_path=xun", ) @@ -95,6 +94,38 @@ func main(){ } ``` +MySQL database + +```golang + db := capsule.New().AddConn("primary", "mysql", + "root:123456@tcp(192.168.31.119:3307)/xun?charset=utf8mb4&parseTime=True&loc=Local", + ) + +``` + +SQLite database + +```golang + db := capsule.New().AddConn("primary","sqlite3", + "file:///data/xun.db", + ) +``` + +Multiple connections + +```golang + db := capsule.New(). + AddConn("primary", "mysql", + "root:123456@tcp(192.168.31.119:3307)/xun?charset=utf8mb4&parseTime=True&loc=Local", + ). + AddReadConn("secondary", "mysql", + "readonly:123456@tcp(192.168.31.119:3306)/xun?charset=utf8mb4&parseTime=True&loc=Local" + ) + +``` + +Read more [Xun Capsule References](docs/capsule.md) + ### Using The Schema Interface ```golang diff --git a/docs/capsule.md b/docs/capsule.md new file mode 100644 index 0000000..0fa0ef8 --- /dev/null +++ b/docs/capsule.md @@ -0,0 +1,3 @@ +# Xun Capsule References + +The capsule references