8 breaking releases

0.10.0 Jul 27, 2021
0.7.0 Jun 5, 2021

#25 in #redis-cluster

MIT license

175KB
4.5K SLoC

salak_factory

A resource initialization factory using salak.

Crates.io Crates.io Documentation dependency status

Please refer to salak factory doc.

Provide Resources

  1. redis_default
  2. redis_cluster
  3. postgres

lib.rs:

A resource initialization factory using salak. salak is a zero-boilerplate configuration parser, it can parsing struct from a unified Environment. After we got the config struct, we can continue to initialize resource from it. That means we have a unified way to package the initialization process of resources, by specifying configuration properties, and provide a customizer to customize resource by coding.

Provide Resources

  1. redis
use salak::*;
use salak_factory::*;
use salak_factory::redis_default::*;
let env = Salak::new().unwrap();
let redis_pool = env.init_resource::<RedisPool>().unwrap();
  1. redis_cluster
use salak::*;
use salak_factory::*;
use salak_factory::redis_cluster::*;
let env = Salak::new().unwrap();
let redis_cluster_pool = env.init_resource::<RedisClusterPool>().unwrap();
  1. postgres
use salak::*;
use salak_factory::*;
use salak_factory::postgresql::*;
let env = Salak::new().unwrap();
let pg_pool = env.init_resource::<PostgresPool>().unwrap();

Dependencies

~1–15MB
~194K SLoC