mirror of
https://codeberg.org/scip/anydb.git
synced 2025-12-17 04:20:59 +01:00
added encryption support
This commit is contained in:
28
app/db.go
28
app/db.go
@@ -20,12 +20,13 @@ type DB struct {
|
||||
}
|
||||
|
||||
type DbEntry struct {
|
||||
Id string `json:"id"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
Bin []byte `json:"bin"`
|
||||
Tags []string `json:"tags"`
|
||||
Created time.Time `json:"created"`
|
||||
Id string `json:"id"`
|
||||
Key string `json:"key"`
|
||||
Value string `json:"value"`
|
||||
Encrypted bool `json:"encrypted"`
|
||||
Bin []byte `json:"bin"`
|
||||
Tags []string `json:"tags"`
|
||||
Created time.Time `json:"created"`
|
||||
}
|
||||
|
||||
type DbEntries []DbEntry
|
||||
@@ -130,16 +131,13 @@ func (db *DB) Set(attr *DbAttr) error {
|
||||
}
|
||||
defer db.Close()
|
||||
|
||||
if err := attr.ParseKV(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
entry := DbEntry{
|
||||
Key: attr.Key,
|
||||
Value: attr.Val,
|
||||
Bin: attr.Bin,
|
||||
Tags: attr.Tags,
|
||||
Created: time.Now(),
|
||||
Key: attr.Key,
|
||||
Value: attr.Val,
|
||||
Bin: attr.Bin,
|
||||
Tags: attr.Tags,
|
||||
Encrypted: attr.Encrypted,
|
||||
Created: time.Now(),
|
||||
}
|
||||
|
||||
// check if the entry already exists and if yes, check if it has
|
||||
|
||||
Reference in New Issue
Block a user