Coder Social home page Coder Social logo

rapidash's People

Contributors

dolow avatar goccy avatar kanataxa avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rapidash's Issues

Support for other databases

After trying to spin up the example project with postgres, I was met with the error:
panic: cannot warm up SecondLevelCache: cannot warm up SecondLevelCache. table is user_logins: failed show create table : failed to execute 'SHOW CREATE TABLE user_logins': pq: syntax error at or near "CREATE"

Upon looking inside of first_lelvel_cache.go it seems showCreateTable unconditionally executes SHOW CREATE TABLE which seems to be a mySQL specific syntax.

From what I can gather, it looks like you're attempting to dump the DDL of a given table. If so, something like:

SELECT *
FROM information_schema.columns
WHERE table_schema = 'public' AND table_name = 'user_logins'
ORDER BY ordinal_position;

Will give you:

table_catalog|table_schema|table_name |column_name    |ordinal_position|column_default                         |is_nullable|data_type             |character_maximum_length|character_octet_length|numeric_precision|numeric_precision_radix|numeric_scale|datetime_precision|interval_type|interval_precision|character_set_catalog|character_set_schema|character_set_name|collation_catalog|collation_schema|collation_name|domain_catalog|domain_schema|domain_name|udt_catalog|udt_schema|udt_name|scope_catalog|scope_schema|scope_name|maximum_cardinality|dtd_identifier|is_self_referencing|is_identity|identity_generation|identity_start|identity_increment|identity_maximum|identity_minimum|identity_cycle|is_generated|generation_expression|is_updatable|
-------------|------------|-----------|---------------|----------------|---------------------------------------|-----------|----------------------|------------------------|----------------------|-----------------|-----------------------|-------------|------------------|-------------|------------------|---------------------|--------------------|------------------|-----------------|----------------|--------------|--------------|-------------|-----------|-----------|----------|--------|-------------|------------|----------|-------------------|--------------|-------------------|-----------|-------------------|--------------|------------------|----------------|----------------|--------------|------------|---------------------|------------|
postgres     |public      |user_logins|id             |               1|nextval('user_logins_id_seq'::regclass)|NO         |bigint                |                        |                      |               64|                      2|            0|                  |             |                  |                     |                    |                  |                 |                |              |              |             |           |postgres   |pg_catalog|int8    |             |            |          |                   |1             |NO                 |NO         |                   |              |                  |                |                |NO            |NEVER       |                     |YES         |
postgres     |public      |user_logins|user_id        |               2|                                       |NO         |bigint                |                        |                      |               64|                      2|            0|                  |             |                  |                     |                    |                  |                 |                |              |              |             |           |postgres   |pg_catalog|int8    |             |            |          |                   |2             |NO                 |NO         |                   |              |                  |                |                |NO            |NEVER       |                     |YES         |
postgres     |public      |user_logins|user_session_id|               3|                                       |NO         |bigint                |                        |                      |               64|                      2|            0|                  |             |                  |                     |                    |                  |                 |                |              |              |             |           |postgres   |pg_catalog|int8    |             |            |          |                   |3             |NO                 |NO         |                   |              |                  |                |                |NO            |NEVER       |                     |YES         |
postgres     |public      |user_logins|login_param_id |               4|                                       |NO         |bigint                |                        |                      |               64|                      2|            0|                  |             |                  |                     |                    |                  |                 |                |              |              |             |           |postgres   |pg_catalog|int8    |             |            |          |                   |4             |NO                 |NO         |                   |              |                  |                |                |NO            |NEVER       |                     |YES         |
postgres     |public      |user_logins|name           |               5|                                       |NO         |character varying     |                     255|                  1020|                 |                       |             |                  |             |                  |                     |                    |                  |                 |                |              |              |             |           |postgres   |pg_catalog|varchar |             |            |          |                   |5             |NO                 |NO         |                   |              |                  |                |                |NO            |NEVER       |                     |YES         |
postgres     |public      |user_logins|created_at     |               6|                                       |NO         |time without time zone|                        |                      |                 |                       |             |                 6|             |                  |                     |                    |                  |                 |                |              |              |             |           |postgres   |pg_catalog|time    |             |            |          |                   |6             |NO                 |NO         |                   |              |                  |                |                |NO            |NEVER       |                     |YES         |
postgres     |public      |user_logins|updated_at     |               7|                                       |NO         |time without time zone|                        |                      |                 |                       |             |                 6|             |                  |                     |                    |                  |                 |                |              |              |             |           |postgres   |pg_catalog|time    |             |            |          |                   |7             |NO                 |NO         |                   |              |                  |                |                |NO            |NEVER       |                     |YES         |

However I'm concerned there are more places that mySQL specific SQL is hiding throughout the codebase.

Are there any ongoing efforts to allow more generic queries to be executed to support more databases?

SLC deletion without manipulating backend RDB

Current CRUD interfaces using QueryBuilder are persistent to backend RDB and I understand that it is necessary to keep atomicity between cache and DB record.
However, sometimes I wanted to delete only second level cache with condition.

If it is OK to add new interface or option, please let me work for this.
Supporting Update and Create clause breaks atomicity between cache and DB records.
I thought it is against to this module's policy so I focused to Delete operation in this topic.

Not working with varchar primary key

	builder := rapidash.NewQueryBuilder("methods").
		Eq("code", code)
	tx.FindByQueryBuilder(builder, &method)

no rows found from db, but i am 100 percent sure there's record in database.

debug log:

{"level":"info","id":"bs5jqb3k3a68d31cfl8g","command":"get","type":"db","key":"SELECT `code`,`name`,`description`,`currency`,`type`,`amount_min`,`amount_max`,`created_at`,`updated_at`,`deleted_at` FROM `methods` WHERE `code` = ?","args":["\"CNYCC\""],"value":"[]","time":1594572076,"message":"<----get------[stash]-----[db]"}
{"level":"info","id":"bs5jqb3k3a68d31cfl8g","command":"set","type":"stash","key":"r/slc/methods/code#\"\\\"CNYCC\\\"\"","value":"nil","time":1594572076,"message":"----set------>[stash]     [server]"}
{"level":"info","id":"bs5jqb3k3a68d31cfl8g","command":"add","type":"server","key":"r/slc/methods/code#\"\\\"CNYCC\\\"\"/lock","value":"{ \"id\": bs5jqb3k3a68d31cfl8g, \"key\": r/slc/methods/code#\"\\\"CNYCC\\\"\", \"time\": 2020-07-13 00:41:16.140798 +0800 CST m=+6.040811516 }","time":1594572076,"message":"----add-------[stash]---->[server]"}
{"level":"info","id":"bs5jqb3k3a68d31cfl8g","command":"set","type":"server","key":"r/slc/methods/code#\"\\\"CNYCC\\\"\"","value":"nil","time":1594572076,"message":"----set-------[stash]---->[server]"}
{"level":"info","id":"bs5jqb3k3a68d31cfl8g","command":"delete","type":"server","key":"r/slc/methods/code#\"\\\"CNYCC\\\"\"/lock","time":1594572076,"message":"---delete-----[stash]---->[server]"}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.