mirror of
https://github.com/documize/community.git
synced 2025-07-25 08:09: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
|
@ -16,7 +16,6 @@ import (
|
|||
"database/sql"
|
||||
"fmt"
|
||||
|
||||
"github.com/documize/community/domain"
|
||||
"github.com/documize/community/domain/store"
|
||||
"github.com/pkg/errors"
|
||||
)
|
||||
|
@ -24,14 +23,14 @@ import (
|
|||
// Store provides data access to user permission information.
|
||||
type Store struct {
|
||||
store.Context
|
||||
domain.SettingStorer
|
||||
store.SettingStorer
|
||||
}
|
||||
|
||||
// Get fetches a configuration JSON element from the config table.
|
||||
func (s Store) Get(area, path string) (value string, err error) {
|
||||
qry := fmt.Sprintf("SELECT %s FROM dmz_config WHERE c_key = '%s';", s.GetJSONValue("c_config", path), area)
|
||||
|
||||
var item = make([]uint8, 0)
|
||||
item := []byte{}
|
||||
err = s.Runtime.Db.Get(&item, qry)
|
||||
if err != nil {
|
||||
return "", err
|
||||
|
@ -83,7 +82,7 @@ func (s Store) Set(area, json string) (err error) {
|
|||
func (s Store) GetUser(orgID, userID, key, path string) (value string, err error) {
|
||||
var item = make([]uint8, 0)
|
||||
|
||||
qry := fmt.Sprintf("SELECT %s FROM dmz_config WHERE c_key = '%s' AND c_orgid='%s' AND c_userid='%s';",
|
||||
qry := fmt.Sprintf("SELECT %s FROM dmz_user_config WHERE c_key = '%s' AND c_orgid='%s' AND c_userid='%s';",
|
||||
s.GetJSONValue("c_config", path), key, orgID, userID)
|
||||
|
||||
err = s.Runtime.Db.Get(&item, qry)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue