MCPcopy
hub / github.com/wailsapp/wails / getFieldOptions

Method getFieldOptions

v2/internal/typescriptify/typescriptify.go:555–587  ·  view source on GitHub ↗
(structType reflect.Type, field reflect.StructField)

Source from the content-addressed store, hash-verified

553}
554
555func (t *TypeScriptify) getFieldOptions(structType reflect.Type, field reflect.StructField) TypeOptions {
556 // By default use options defined by tags:
557 opts := TypeOptions{TSTransform: field.Tag.Get(tsTransformTag), TSType: field.Tag.Get(tsType)}
558
559 overrides := []TypeOptions{}
560
561 // But there is maybe an struct-specific override:
562 for _, strct := range t.structTypes {
563 if strct.FieldOptions == nil {
564 continue
565 }
566 if strct.Type == structType {
567 if fldOpts, found := strct.FieldOptions[field.Type]; found {
568 overrides = append(overrides, fldOpts)
569 }
570 }
571 }
572
573 if fldOpts, found := t.fieldTypeOptions[field.Type]; found {
574 overrides = append(overrides, fldOpts)
575 }
576
577 for _, o := range overrides {
578 if o.TSTransform != "" {
579 opts.TSTransform = o.TSTransform
580 }
581 if o.TSType != "" {
582 opts.TSType = o.TSType
583 }
584 }
585
586 return opts
587}
588
589func (t *TypeScriptify) getJSONFieldName(field reflect.StructField, isPtr bool) string {
590 jsonFieldName := ""

Callers 1

convertTypeMethod · 0.95

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected