Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dnsang/scala-common-lib
common backend library for scala/java developer.
https://github.com/dnsang/scala-common-lib
backend java scala ssdb
Last synced: 2 months ago
JSON representation
common backend library for scala/java developer.
- Host: GitHub
- URL: https://github.com/dnsang/scala-common-lib
- Owner: dnsang
- Created: 2020-03-02T07:14:04.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-06-21T03:52:55.000Z (over 2 years ago)
- Last Synced: 2023-08-24T02:54:51.679Z (over 1 year ago)
- Topics: backend, java, scala, ssdb
- Language: Scala
- Size: 110 KB
- Stars: 2
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Scala Common Lib
This project aims to provide a generic common backend interface/impl for java/scala developers.
I32IdGenerator
val idGen = I32IdGenerator("project_a","user_id", ssdb)
val id = idGen.getNextId()List
val listUserFriends = SsdbList[Int]("user_a", ssdb)
listUserFriends.multiPushFront(Array(1,2,3,4))
val listUserMessages = SsdbList[String]("id")
val listTransaction = SsdbList[Transaction]("user_id")
KeyValueDB
val kvs = SsdbKVS[String,String]("user_db",ssdb)
kvs.add("user_id","{ json_user_value }")
val value = kvs.get("user_id")
val dbUserProfile = SsdbKVS[Long,UserProfile]("user_profile")
val jackProfile = UserProfile(123,"Jack",19,"[email protected]")
dbUserProfile.add(123L, jackProfile)
val profile = dbUserProfile.get(123)
SortedSet
val leaderboard = SSdbSortedSet("game_a",ssdb)
leaderboard.add("user_1",100)
val rank = leaderboard.rank("user_1")
val top10 = leaderboard.range(0,10)JDBC Client
val client = NativeJdbcClient("jdbc:mysql://127.0.0.1:9000", "user", "password")
// Insert a row
client.executeUpdate(
s"insert into users(id, name, age, created_date) values(?, ?, ?, ?);",
1, "user1", 1, new Date(1589446762000L))
// Delete a row
val afftedRows = client.executeUpdate(s"delete from users where id = ?", 1)Usage
```
education.x
common-backend
2.3-SnapShot
```