Change s to sf
This commit is contained in:
parent
69e61e3e7f
commit
5a7fa89670
@ -70,52 +70,52 @@ type StructField struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TagSettingsSet Sets a tag in the tag settings map
|
// TagSettingsSet Sets a tag in the tag settings map
|
||||||
func (s *StructField) TagSettingsSet(key, val string) {
|
func (sf *StructField) TagSettingsSet(key, val string) {
|
||||||
s.tagSettingsLock.Lock()
|
sf.tagSettingsLock.Lock()
|
||||||
defer s.tagSettingsLock.Unlock()
|
defer sf.tagSettingsLock.Unlock()
|
||||||
s.TagSettings[key] = val
|
sf.TagSettings[key] = val
|
||||||
}
|
}
|
||||||
|
|
||||||
// TagSettingsGet returns a tag from the tag settings
|
// TagSettingsGet returns a tag from the tag settings
|
||||||
func (s *StructField) TagSettingsGet(key string) (string, bool) {
|
func (sf *StructField) TagSettingsGet(key string) (string, bool) {
|
||||||
s.tagSettingsLock.RLock()
|
sf.tagSettingsLock.RLock()
|
||||||
defer s.tagSettingsLock.RUnlock()
|
defer sf.tagSettingsLock.RUnlock()
|
||||||
val, ok := s.TagSettings[key]
|
val, ok := sf.TagSettings[key]
|
||||||
return val, ok
|
return val, ok
|
||||||
}
|
}
|
||||||
|
|
||||||
// TagSettingsDelete deletes a tag
|
// TagSettingsDelete deletes a tag
|
||||||
func (s *StructField) TagSettingsDelete(key string) {
|
func (sf *StructField) TagSettingsDelete(key string) {
|
||||||
s.tagSettingsLock.Lock()
|
sf.tagSettingsLock.Lock()
|
||||||
defer s.tagSettingsLock.Unlock()
|
defer sf.tagSettingsLock.Unlock()
|
||||||
delete(s.TagSettings, key)
|
delete(sf.TagSettings, key)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *StructField) clone() *StructField {
|
func (sf *StructField) clone() *StructField {
|
||||||
clone := &StructField{
|
clone := &StructField{
|
||||||
DBName: s.DBName,
|
DBName: sf.DBName,
|
||||||
Name: s.Name,
|
Name: sf.Name,
|
||||||
Names: s.Names,
|
Names: sf.Names,
|
||||||
IsPrimaryKey: s.IsPrimaryKey,
|
IsPrimaryKey: sf.IsPrimaryKey,
|
||||||
IsNormal: s.IsNormal,
|
IsNormal: sf.IsNormal,
|
||||||
IsIgnored: s.IsIgnored,
|
IsIgnored: sf.IsIgnored,
|
||||||
IsScanner: s.IsScanner,
|
IsScanner: sf.IsScanner,
|
||||||
HasDefaultValue: s.HasDefaultValue,
|
HasDefaultValue: sf.HasDefaultValue,
|
||||||
Tag: s.Tag,
|
Tag: sf.Tag,
|
||||||
TagSettings: map[string]string{},
|
TagSettings: map[string]string{},
|
||||||
Struct: s.Struct,
|
Struct: sf.Struct,
|
||||||
IsForeignKey: s.IsForeignKey,
|
IsForeignKey: sf.IsForeignKey,
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Relationship != nil {
|
if sf.Relationship != nil {
|
||||||
relationship := *s.Relationship
|
relationship := *sf.Relationship
|
||||||
clone.Relationship = &relationship
|
clone.Relationship = &relationship
|
||||||
}
|
}
|
||||||
|
|
||||||
// copy the struct field tagSettings, they should be read-locked while they are copied
|
// copy the struct field tagSettings, they should be read-locked while they are copied
|
||||||
s.tagSettingsLock.Lock()
|
sf.tagSettingsLock.Lock()
|
||||||
defer s.tagSettingsLock.Unlock()
|
defer sf.tagSettingsLock.Unlock()
|
||||||
for key, value := range s.TagSettings {
|
for key, value := range sf.TagSettings {
|
||||||
clone.TagSettings[key] = value
|
clone.TagSettings[key] = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user