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
|
@ -17,7 +17,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"
|
||||
|
@ -35,6 +34,7 @@ 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/lib/pq" // the mysql driver is required behind the scenes
|
||||
)
|
||||
|
@ -49,7 +49,7 @@ type PostgreSQLProvider struct {
|
|||
}
|
||||
|
||||
// SetPostgreSQLProvider creates PostgreSQL provider
|
||||
func SetPostgreSQLProvider(r *env.Runtime, s *domain.Store) {
|
||||
func SetPostgreSQLProvider(r *env.Runtime, s *store.Store) {
|
||||
// Set up provider specific details and wire up data prividers.
|
||||
r.StoreProvider = PostgreSQLProvider{
|
||||
ConnectionString: r.Flags.DBConn,
|
||||
|
@ -270,7 +270,11 @@ func (p PostgreSQLProvider) JSONEmpty() string {
|
|||
// JSONGetValue returns JSON attribute selection syntax.
|
||||
// Typically used in SELECT <my_json_field> query.
|
||||
func (p PostgreSQLProvider) JSONGetValue(column, attribute string) string {
|
||||
return fmt.Sprintf("%s -> '%s'", column, attribute)
|
||||
if len(attribute) > 0 {
|
||||
return fmt.Sprintf("%s -> '%s'", column, attribute)
|
||||
}
|
||||
|
||||
return fmt.Sprintf("%s", column)
|
||||
}
|
||||
|
||||
// VerfiyVersion checks to see if actual database meets
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue