gitlab.com/evatix-go/core@v1.3.55/coredata/corestr/HashmapDataModel.go (about)

     1  package corestr
     2  
     3  import "sync"
     4  
     5  type HashmapDataModel struct {
     6  	Items map[string]string `json:"Hashmap"`
     7  }
     8  
     9  func NewHashmapUsingDataModel(dataModel *HashmapDataModel) *Hashmap {
    10  	length := 0
    11  
    12  	if dataModel.Items != nil {
    13  		length = len(dataModel.Items)
    14  	}
    15  
    16  	return &Hashmap{
    17  		items:         dataModel.Items,
    18  		hasMapUpdated: false,
    19  		cachedList:    nil,
    20  		length:        length,
    21  		isEmptySet:    length == 0,
    22  		Mutex:         sync.Mutex{},
    23  	}
    24  }
    25  
    26  func NewHashmapsDataModelUsing(collection *Hashmap) *HashmapDataModel {
    27  	return &HashmapDataModel{
    28  		Items: collection.items,
    29  	}
    30  }