Security News
TC39 Advances 10+ ECMAScript Proposals: Key Features to Watch
TC39 is meeting in Tokyo this week and they have approved nearly a dozen proposals to advance to the next stages.
github.com/scbizu/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.
Security News
TC39 is meeting in Tokyo this week and they have approved nearly a dozen proposals to advance to the next stages.
Security News
Our threat research team breaks down two malicious npm packages designed to exploit developer trust, steal your data, and destroy data on your machine.
Security News
A senior white house official is urging insurers to stop covering ransomware payments, indicating possible stricter regulations to deter cybercrime.