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

     1  package corestr
     2  
     3  import "sync"
     4  
     5  type HashsetDataModel struct {
     6  	Items map[string]bool `json:"Hashset"`
     7  }
     8  
     9  func NewHashsetUsingDataModel(dataModel *HashsetDataModel) *Hashset {
    10  	length := 0
    11  
    12  	if dataModel.Items != nil {
    13  		length = len(dataModel.Items)
    14  	}
    15  
    16  	return &Hashset{
    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 NewHashsetsDataModelUsing(collection *Hashset) *HashsetDataModel {
    27  	return &HashsetDataModel{
    28  		Items: collection.items,
    29  	}
    30  }