mirror of
https://github.com/safing/portbase
synced 2025-09-10 23:34:42 +00:00
Improve database meta handling
This commit is contained in:
parent
0e2733a342
commit
1133c78f85
5 changed files with 24 additions and 9 deletions
|
@ -36,9 +36,7 @@ type Options struct {
|
|||
|
||||
// Apply applies options to the record metadata.
|
||||
func (o *Options) Apply(r record.Record) {
|
||||
if r.Meta() == nil {
|
||||
r.SetMeta(&record.Meta{})
|
||||
}
|
||||
r.UpdateMeta()
|
||||
if o.AlwaysMakeSecret {
|
||||
r.Meta().MakeSecret()
|
||||
}
|
||||
|
@ -198,7 +196,7 @@ func (i *Interface) PutNew(r record.Record) error {
|
|||
defer r.Unlock()
|
||||
|
||||
if r.Meta() == nil {
|
||||
r.SetMeta(&record.Meta{})
|
||||
r.CreateMeta()
|
||||
}
|
||||
r.Meta().Reset()
|
||||
i.options.Apply(r)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue