Discover Packages
github.com/vincentserpoul/playwithsql
status
package
Version:
v0.0.0-...-09ecf48
Opens a new window with list of versions in this module.
Published: Aug 25, 2017
License: Apache-2.0
Opens a new window with license information.
Imports: 17
Opens a new window with list of imports.
Imported by: 0
Opens a new window with list of known importers.
Jump to ...
README
Documentation
Index
Constants
Variables
Functions
Types
type ActionID
type Entityone
SelectEntityoneByStatus(ctx, q, link, statusID)
SelectEntityoneOneByPK(ctx, q, link, entityID)
(e) Create(ctx, db, link)
(e) UpdateStatus(ctx, db, link, actionID, statusID)
type SQLIntImpl
type SQLLink
type Status
type StatusID
Source Files
Directories
README
README
¶
bench golang
on Intel(R) Core(TM) i7-5500U CPU @ 2.40GHz, 16GB ram
$ ./status/run-test.sh
====================
Cockroachdb
islatest
--------
BenchmarkCreate-4 500 10468330 ns/op
BenchmarkUpdateStatus-4 500 9011778 ns/op
BenchmarkSelectEntityoneByStatus-4 300 18448235 ns/op
BenchmarkSelectEntityoneOneByPK-4 300 17290208 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 26.662s
lateststatus
------------
BenchmarkCreate-4 300 13330483 ns/op
BenchmarkUpdateStatus-4 500 10548141 ns/op
BenchmarkSelectEntityoneByStatus-4 300 15148713 ns/op
BenchmarkSelectEntityoneOneByPK-4 500 9512001 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 24.508s
history
-------
BenchmarkCreate-4 500 10360480 ns/op
BenchmarkUpdateStatus-4 500 10700921 ns/op
BenchmarkSelectEntityoneByStatus-4 3000 1349362 ns/op
BenchmarkSelectEntityoneOneByPK-4 5000 1199731 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 23.754s
====================
MSSQL
islatest
--------
BenchmarkCreate-4 2000 2151683 ns/op
BenchmarkUpdateStatus-4 3000 1502009 ns/op
BenchmarkSelectEntityoneByStatus-4 10000 410183 ns/op
BenchmarkSelectEntityoneOneByPK-4 10000 371751 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 17.162s
lateststatus
------------
BenchmarkCreate-4 2000 2441415 ns/op
BenchmarkUpdateStatus-4 2000 1934141 ns/op
BenchmarkSelectEntityoneByStatus-4 10000 409696 ns/op
BenchmarkSelectEntityoneOneByPK-4 10000 358960 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 17.056s
history
-------
BenchmarkCreate-4 2000 1877509 ns/op
BenchmarkUpdateStatus-4 3000 1361104 ns/op
BenchmarkSelectEntityoneByStatus-4 10000 358764 ns/op
BenchmarkSelectEntityoneOneByPK-4 10000 324062 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 15.149s
====================
MySQL
islatest
--------
BenchmarkCreate-4 2000 2499545 ns/op
BenchmarkUpdateStatus-4 2000 2526334 ns/op
BenchmarkSelectEntityoneByStatus-4 10000 426611 ns/op
BenchmarkSelectEntityoneOneByPK-4 10000 418569 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 19.206s
lateststatus
------------
BenchmarkCreate-4 2000 2069397 ns/op
BenchmarkUpdateStatus-4 2000 2056994 ns/op
BenchmarkSelectEntityoneByStatus-4 10000 422564 ns/op
BenchmarkSelectEntityoneOneByPK-4 10000 368221 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 16.790s
history
-------
BenchmarkCreate-4 2000 1740044 ns/op
BenchmarkUpdateStatus-4 2000 2054322 ns/op
BenchmarkSelectEntityoneByStatus-4 10000 368390 ns/op
BenchmarkSelectEntityoneOneByPK-4 10000 319086 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 15.055s
====================
Postgres
islatest
--------
BenchmarkCreate-4 2000 2063406 ns/op
BenchmarkUpdateStatus-4 2000 1775458 ns/op
BenchmarkSelectEntityoneByStatus-4 10000 634958 ns/op
BenchmarkSelectEntityoneOneByPK-4 10000 491673 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 19.600s
lateststatus
------------
BenchmarkCreate-4 3000 1724629 ns/op
BenchmarkUpdateStatus-4 2000 1644451 ns/op
BenchmarkSelectEntityoneByStatus-4 5000 754812 ns/op
BenchmarkSelectEntityoneOneByPK-4 10000 494935 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 17.760s
history
-------
BenchmarkCreate-4 3000 1751059 ns/op
BenchmarkUpdateStatus-4 2000 2095055 ns/op
BenchmarkSelectEntityoneByStatus-4 5000 639743 ns/op
BenchmarkSelectEntityoneOneByPK-4 10000 313535 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 16.323s
====================
SQLite
islatest
--------
BenchmarkCreate-4 1000 5139560 ns/op
BenchmarkUpdateStatus-4 1000 5128113 ns/op
BenchmarkSelectEntityoneByStatus-4 50000 93758 ns/op
BenchmarkSelectEntityoneOneByPK-4 100000 90393 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 26.589s
lateststatus
------------
BenchmarkCreate-4 1000 6139074 ns/op
BenchmarkUpdateStatus-4 1000 5803292 ns/op
BenchmarkSelectEntityoneByStatus-4 50000 124262 ns/op
BenchmarkSelectEntityoneOneByPK-4 50000 114864 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 27.136s
history
-------
BenchmarkCreate-4 1000 5519332 ns/op
BenchmarkUpdateStatus-4 1000 5600910 ns/op
BenchmarkSelectEntityoneByStatus-4 50000 91100 ns/op
BenchmarkSelectEntityoneOneByPK-4 100000 77634 ns/op
PASS
ok github.com/vincentserpoul/playwithsql/status 26.121s
Expand ▾
Collapse ▴
Documentation
¶
ActionID represents the action performed on the tradeoffer request
type Entityone struct {
ID int64 `db:"entityone_id" json:"entityone_id"`
TimeCreated time .Time `db:"time_created" json:"time_created"`
Status `json:"status"`
}
Entityone represents an event
SelectEntityoneByStatus will retrieve one entityone from a selected status
SelectEntityoneOneByPK will retrieve one entityone from a selected status
Create will create an entityone
UpdateStatus will update the status of an Entityone into db
SQLIntImpl allows to contains an interface
GetSQLIntImpl returns the type of link according to the dbtype
type SQLLink interface {
MigrateUp(ctx context .Context , exec sqlx .ExecerContext ) (errExec error )
MigrateDown(ctx context .Context , exec sqlx .ExecerContext ) (errExec error )
Create(ctx context .Context , exec *sqlx .Tx , actionID, statusID int ) (int64 , error )
SaveStatus(
ctx context .Context ,
exec *sqlx .Tx ,
entityID int64 ,
actionID int ,
statusID int ,
) error
SelectEntityone(
ctx context .Context ,
q *sqlx .DB ,
entityIDs []int64 ,
isStatusIDs []int ,
notStatusIDs []int ,
neverStatusIDs []int ,
hasStatusIDs []int ,
limit int ,
) (*sqlx .Rows , error )
}
SQLLink is used to define SQL interactions
type Status struct {
ActionID ActionID `db:"action_id" json:"action_id"`
StatusID StatusID `db:"status_id" json:"status_id"`
TimeCreated time .Time `db:"status_time_created" json:"time_created"`
}
Status of the entity
StatusID represents the state of the tradeoffer, see constants
Source Files
¶
Directories
¶
Click to show internal directories.
Click to hide internal directories.