github.com/ydb-platform/ydb-go-sdk/v3@v3.57.0/internal/query/scanner/struct_options.go (about) 1 package scanner 2 3 type ( 4 ScanStructOption interface { 5 applyScanStructOption(settings *scanStructSettings) 6 } 7 tagName string 8 allowMissingColumnsFromSelect struct{} 9 allowMissingFieldsInStruct struct{} 10 ) 11 12 var ( 13 _ ScanStructOption = tagName("") 14 _ ScanStructOption = allowMissingColumnsFromSelect{} 15 _ ScanStructOption = allowMissingFieldsInStruct{} 16 ) 17 18 func (allowMissingFieldsInStruct) applyScanStructOption(settings *scanStructSettings) { 19 settings.AllowMissingFieldsInStruct = true 20 } 21 22 func (allowMissingColumnsFromSelect) applyScanStructOption(settings *scanStructSettings) { 23 settings.AllowMissingColumnsFromSelect = true 24 } 25 26 func (name tagName) applyScanStructOption(settings *scanStructSettings) { 27 settings.TagName = string(name) 28 } 29 30 func WithTagName(name string) tagName { 31 return tagName(name) 32 } 33 34 func WithAllowMissingColumnsFromSelect() allowMissingColumnsFromSelect { 35 return allowMissingColumnsFromSelect{} 36 } 37 38 func WithAllowMissingFieldsInStruct() allowMissingFieldsInStruct { 39 return allowMissingFieldsInStruct{} 40 }