1
0
mirror of https://github.com/pocketbase/pocketbase.git synced 2025-11-25 07:34:10 +02:00

changed store.Store to accept generic key type

This commit is contained in:
Gani Georgiev
2024-12-23 15:44:00 +02:00
parent e18116d859
commit 39df26ee21
12 changed files with 57 additions and 54 deletions

View File

@@ -37,9 +37,9 @@ var (
type Record struct {
collection *Collection
originalData map[string]any
customVisibility *store.Store[bool]
data *store.Store[any]
expand *store.Store[any]
customVisibility *store.Store[string, bool]
data *store.Store[string, any]
expand *store.Store[string, any]
BaseModel
@@ -537,8 +537,8 @@ func newRecordsFromNullStringMaps(collection *Collection, rows []dbx.NullStringM
func NewRecord(collection *Collection) *Record {
record := &Record{
collection: collection,
data: store.New[any](nil),
customVisibility: store.New[bool](nil),
data: store.New[string, any](nil),
customVisibility: store.New[string, bool](nil),
originalData: make(map[string]any, len(collection.Fields)),
}
@@ -681,7 +681,7 @@ func (m *Record) Expand() map[string]any {
// SetExpand replaces the current Record's expand with the provided expand arg data (shallow copied).
func (m *Record) SetExpand(expand map[string]any) {
if m.expand == nil {
m.expand = store.New[any](nil)
m.expand = store.New[string, any](nil)
}
m.expand.Reset(expand)