/silver-bullet

๐ŸบโŒ๐Ÿ”ซ Middleware Adaptor.

Primary LanguageJava

Silver-Bullet ้“ถๅผน

Reduce the pain of middleware migration.

silver-bullet-cache ็ผ“ๅญ˜้€‚้…

Middleware get(key) set(key, value) get(key, loader)
Guava โœ… โœ… โœ…
Redis โœ… โœ… โŒ

Code Example


silver-bullet-database ๆ•ฐๆฎๅบ“้€‚้…

Middleware Transaction JPA NamedQuery
JDBC โœ… โœ…
Elasticsearch โŒ โœ…

JPA NamedQuery Example

public interface TestRepository extends JpaRepository<Test, Long> {
    List<Test> findByName(String name);
    // means select * from test where name = ?
}

Code Example


silver-bullet-json JSON้€‚้…

Middleware Serialize Deserialize PartialObjectParse
FastJSON 2 โœ… โœ… โœ…
Jackson โœ… โœ… Coming soon
GSON Coming soon Coming soon Coming soon

Code Example

@Test
public void testPartialStr() {
    JSONObject jsonObject = JSON.partialToObject("{\"name\": \"Alice\", \"age\": 30, \"city\": \"New Yor");
    String city = (String) jsonObject.get("city");
    Assertions.assertEquals("New Yor", city);
}

silver-bullet-lock ้”้€‚้…

Middleware Lock / Unlock TryLock
Redis โœ… โœ…
Zookeeper Coming soon Coming soon

Redis Code Example