Research
Security News
Quasar RAT Disguised as an npm Package for Detecting Vulnerabilities in Ethereum Smart Contracts
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
github.com/matfax/go-redis-orm
redis-orm fly orm up
$: go get github.com/ezbuy/redis-orm
$: redis-orm code -i example/yaml -o example/model
import "github.com/ezbuy/redis-orm/example/model"
# mysql
model.MySQLSetup(cf)
db := model.MySQL()
//! query (ids []string) by unique & index & range definitions
model.UserDBMgr(db).FindOne(unique)
model.UserDBMgr(db).Find(index)
model.UserDBMgr(db).Range(scope)
model.UserDBMgr(db).RangeRevert(scope)
//! fetch object
model.UserDBMgr(db).Fetch(pk PrimaryKey) (*User, error)
model.UserDBMgr(db).FetchByPrimaryKeys(pks []PrimaryKey) ([]*User, error)
# redis
model.RedisSetup(cf)
redis := model.Redis()
//! query (ids []string) by unique & index & range definitions
model.UserRedisMgr(redis).FindOne(unique)
model.UserRedisMgr(redis).Find(index)
model.UserRedisMgr(redis).Range(scope)
model.UserRedisMgr(redis).RangeRevert(scope)
//! fetch object
model.UserRedisMgr(redis).Fetch(pk PrimaryKey) (*User, error)
model.UserRedisMgr(redis).FetchByPrimaryKeys(pks []PrimaryKey) ([]*User, error)
import "github.com/ezbuy/redis-orm/example/model"
# mysql
model.MySQLSetup(cf)
db := model.MySQL()
tx, err := db.BeginTx()
defer tx.Close()
model.UserDBMgr(tx).Save(obj)
model.UserDBMgr(tx).Create(obj)
model.UserDBMgr(tx).Update(obj)
model.UserDBMgr(tx).Delete(obj)
model.UserDBMgr(tx).FindOne(unique)
model.UserDBMgr(tx).Find(index)
model.UserDBMgr(tx).Range(scope)
model.UserDBMgr(tx).RangeRevert(scope)
model.UserDBMgr(tx).Fetch(id string) (*User, error)
model.UserDBMgr(tx).FetchByPrimaryKeys(pks []PrimaryKey) ([]*User, error)
# redis
model.RedisSetup(cf)
redis := model.Redis()
model.UserRedisMgr(redis).Save(obj)
model.UserRedisMgr(redis).Create(obj)
model.UserRedisMgr(redis).Update(obj)
model.UserRedisMgr(redis).Delete(obj)
import "github.com/ezbuy/redis-orm/example/model"
model.MySQLSetup(cf)
model.RedisSetup(cf)
db := model.MySQL()
redis := model.Redis()
model.UserRedisMgr(redis).Load(model.UserDBMgr(db))
enviroment:
mysql-server, redis-server, test client all in the same machine (mac air)
redis-orm.redis.bench
Ran 1000 samples:
unique.runtime:
Fastest Time: 0.000s
Slowest Time: 0.001s
Average Time: 0.000s ± 0.000s
index.runtime:
Fastest Time: 0.000s
Slowest Time: 0.000s
Average Time: 0.000s ± 0.000s
range.runtime:
Fastest Time: 0.000s
Slowest Time: 0.000s
Average Time: 0.000s ± 0.000s
range.revert.runtime:
Fastest Time: 0.000s
Slowest Time: 0.000s
Average Time: 0.000s ± 0.000s
fetch.runtime:
Fastest Time: 0.002s
Slowest Time: 0.004s
Average Time: 0.002s ± 0.000s
redis-orm.mysql.bench
Ran 1000 samples:
unique.runtime:
Fastest Time: 0.002s
Slowest Time: 0.106s
Average Time: 0.003s ± 0.005s
index.runtime:
Fastest Time: 0.002s
Slowest Time: 0.106s
Average Time: 0.003s ± 0.005s
range.runtime:
Fastest Time: 0.002s
Slowest Time: 0.105s
Average Time: 0.002s ± 0.005s
range.revert.runtime:
Fastest Time: 0.002s
Slowest Time: 0.105s
Average Time: 0.002s ± 0.006s
fetch.runtime:
Fastest Time: 0.004s
Slowest Time: 0.150s
Average Time: 0.006s ± 0.009s
FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket researchers uncover a malicious npm package posing as a tool for detecting vulnerabilities in Etherium smart contracts.
Security News
Research
A supply chain attack on Rspack's npm packages injected cryptomining malware, potentially impacting thousands of developers.
Research
Security News
Socket researchers discovered a malware campaign on npm delivering the Skuld infostealer via typosquatted packages, exposing sensitive data.