Interface StoreDialect
- All Known Implementing Classes:
AbstractJdbcDialect,H2Dialect,MysqlDialect,PostgresDialect,SqliteDialect
Defines the create-schema DDL (abstract, varies per database) and ANSI-standard
business SQL (default methods returning BoundSql). The aggregate class
AbstractJdbcDialect implements this interface along with the other table-domain
interfaces; vendor classes extend the aggregate and override only what differs.
Method names are prefixed with store to avoid collision when the
aggregate class implements multiple table-domain interfaces.
Secondary index: the namespace_path LIKE 'prefix%' query in
storeSearch(java.lang.String, int, int) requires an index on namespace_path to avoid a full table
scan on large stores. Where the database supports it (MySQL), vendors inline
INDEX idx_namespace (namespace_path) in the CREATE TABLE statement;
the others append an idempotent CREATE INDEX IF NOT EXISTS as a second element
of the storeCreateTableDdls() list.
- Author:
- shanhongyu
-
Method Summary
Modifier and TypeMethodDescriptiondefault BoundSqlstoreCasUpdate(String json, long timestamp, String namespacePath, String key, long expectedVersion) Conditional UPDATE for CAS path.DDL statements (one or more) to create the KV store table.default BoundSqlstoreDelete(String namespacePath, String key) Single-item DELETE.default BoundSqlstoreInsert(String namespacePath, String key, String json, long timestamp) INSERT for create-only writes (version starts at 1).default charEscape character for LIKE patterns instoreSearch(java.lang.String, int, int).default BoundSqlstoreSearch(String likePattern, int limit, int offset) Namespace-prefix search with pagination.default BoundSqlstoreSelect(String namespacePath, String key) Single-item SELECT.default StringBase table name (without prefix).storeUpsert(String namespacePath, String key, String json, long timestamp) UPSERT: insert new row with version=1 or update existing row with version+1.
-
Method Details
-
storeTableName
Base table name (without prefix). -
storeCreateTableDdls
DDL statements (one or more) to create the KV store table. Must be idempotent. -
storeUpsert
UPSERT: insert new row with version=1 or update existing row with version+1. -
storeInsert
INSERT for create-only writes (version starts at 1). PK violation = row exists. -
storeCasUpdate
default BoundSql storeCasUpdate(String json, long timestamp, String namespacePath, String key, long expectedVersion) Conditional UPDATE for CAS path. Returns affected-row count (1=success). -
storeSelect
Single-item SELECT. Projection: (value_json, version). -
storeDelete
Single-item DELETE. -
storeSearch
Namespace-prefix search with pagination. Projection: (item_key, value_json, version). -
storeLikeEscapeChar
default char storeLikeEscapeChar()Escape character for LIKE patterns instoreSearch(java.lang.String, int, int).
-