mirror of
https://github.com/documize/community.git
synced 2025-07-19 13:19:43 +02:00
Continued MySQL/PostgreSQL store provider refactoring
Refactored, renamed, removed storage related code. Basic smoke test passed for PostgreSQL whilst fully working on MySQL variants as per usual.
This commit is contained in:
parent
b455e5eaf5
commit
97beb3f4d3
81 changed files with 1454 additions and 1497 deletions
|
@ -19,7 +19,6 @@ import (
|
|||
"strings"
|
||||
|
||||
"github.com/documize/community/core/env"
|
||||
"github.com/documize/community/domain"
|
||||
account "github.com/documize/community/domain/account"
|
||||
activity "github.com/documize/community/domain/activity"
|
||||
attachment "github.com/documize/community/domain/attachment"
|
||||
|
@ -37,12 +36,13 @@ import (
|
|||
search "github.com/documize/community/domain/search"
|
||||
setting "github.com/documize/community/domain/setting"
|
||||
space "github.com/documize/community/domain/space"
|
||||
"github.com/documize/community/domain/store"
|
||||
user "github.com/documize/community/domain/user"
|
||||
_ "github.com/go-sql-driver/mysql" // the mysql driver is required behind the scenes
|
||||
)
|
||||
|
||||
// SetMySQLProvider creates MySQL provider
|
||||
func SetMySQLProvider(r *env.Runtime, s *domain.Store) {
|
||||
func SetMySQLProvider(r *env.Runtime, s *store.Store) {
|
||||
// Set up provider specific details and wire up data prividers.
|
||||
r.StoreProvider = MySQLProvider{
|
||||
ConnectionString: r.Flags.DBConn,
|
||||
|
@ -296,7 +296,11 @@ func (p MySQLProvider) JSONEmpty() string {
|
|||
// JSONGetValue returns JSON attribute selection syntax.
|
||||
// Typically used in SELECT <my_json_field> query.
|
||||
func (p MySQLProvider) JSONGetValue(column, attribute string) string {
|
||||
return fmt.Sprintf("JSON_EXTRACT(%s,'$.%s')", column, attribute)
|
||||
if len(attribute) > 0 {
|
||||
return fmt.Sprintf("JSON_EXTRACT(%s,'$.%s')", column, attribute)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("JSON_EXTRACT(%s,'$')", column)
|
||||
}
|
||||
|
||||
// VerfiyVersion checks to see if actual database meets
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue