github.com/urso/go-structform@v0.0.2/gotype/unfold_ignore.yml (about)

     1  main: |
     2    package gotype
     3  
     4    {{ invoke "makeIgnoreType" "type" "" }}
     5  
     6    func (*unfolderIgnore) onValue(ctx *unfoldCtx) error {
     7      ctx.unfolder.pop()
     8      return nil
     9    }
    10  
    11    {{ invoke "makeIgnoreType" "type" "Arr" }}
    12  
    13    func (*unfolderIgnoreArr) onValue(ctx *unfoldCtx) error {
    14      return nil
    15    }
    16  
    17    func (*unfolderIgnoreArr) OnArrayFinished(ctx *unfoldCtx) error {
    18      ctx.unfolder.pop()
    19      return nil
    20    }
    21  
    22    {{ invoke "makeIgnoreType" "type" "Obj" }}
    23  
    24    func (*unfolderIgnoreObj) onValue(ctx *unfoldCtx) error {
    25      return nil
    26    }
    27  
    28    func (*unfolderIgnoreObj) OnObjectFinished(ctx *unfoldCtx) error {
    29      ctx.unfolder.pop()
    30      return nil
    31    }
    32  
    33  templates.makeIgnoreType: |
    34    {{ $type := .type }}
    35    {{ $tUnfolder := printf "unfolderIgnore%v" $type }}
    36  
    37    type unfoldIgnore{{ $type }}Value struct {}
    38    type unfoldIgnore{{ $type }}Ptr struct {}
    39    type {{ $tUnfolder }} struct {
    40      unfolderErrUnknown
    41    }
    42  
    43    var (
    44      _singletonUnfoldIgnore{{ $type }}Value = &unfoldIgnore{{ $type }}Value{}
    45      _singletonUnfoldIgnore{{ $type }}Ptr = &unfoldIgnore{{ $type }}Ptr{}
    46      _singleton{{ $tUnfolder }} = &{{ $tUnfolder }}{}
    47    )
    48  
    49    func (*unfoldIgnore{{ $type }}Value) initState(ctx *unfoldCtx, _ reflect.Value) {
    50      ctx.unfolder.push(_singleton{{ $tUnfolder }})
    51    }
    52  
    53    func (*unfoldIgnore{{ $type }}Ptr) initState(ctx *unfoldCtx, _ unsafe.Pointer) {
    54      ctx.unfolder.push(_singleton{{ $tUnfolder }})
    55    }
    56  
    57    func (u *{{ $tUnfolder }}) OnNil(ctx *unfoldCtx) error { return u.onValue(ctx) }
    58    func (u *{{ $tUnfolder }}) OnBool(ctx *unfoldCtx, _ bool) error { return u.onValue(ctx) }
    59    func (u *{{ $tUnfolder }}) OnString(ctx *unfoldCtx, _ string) error { return u.onValue(ctx) }
    60    func (u *{{ $tUnfolder }}) OnInt8(ctx *unfoldCtx, _ int8) error { return u.onValue(ctx) }
    61    func (u *{{ $tUnfolder }}) OnInt16(ctx *unfoldCtx, _ int16) error { return u.onValue(ctx) }
    62    func (u *{{ $tUnfolder }}) OnInt32(ctx *unfoldCtx, _ int32) error { return u.onValue(ctx) }
    63    func (u *{{ $tUnfolder }}) OnInt64(ctx *unfoldCtx, _ int64) error { return u.onValue(ctx) }
    64    func (u *{{ $tUnfolder }}) OnInt(ctx *unfoldCtx, _ int) error { return u.onValue(ctx) }
    65    func (u *{{ $tUnfolder }}) OnByte(ctx *unfoldCtx, _ byte) error { return u.onValue(ctx) }
    66    func (u *{{ $tUnfolder }}) OnUint8(ctx *unfoldCtx, _ uint8) error { return u.onValue(ctx) }
    67    func (u *{{ $tUnfolder }}) OnUint16(ctx *unfoldCtx, _ uint16) error { return u.onValue(ctx) }
    68    func (u *{{ $tUnfolder }}) OnUint32(ctx *unfoldCtx, _ uint32) error { return u.onValue(ctx) }
    69    func (u *{{ $tUnfolder }}) OnUint64(ctx *unfoldCtx, _ uint64) error { return u.onValue(ctx) }
    70    func (u *{{ $tUnfolder }}) OnUint(ctx *unfoldCtx, _ uint) error { return u.onValue(ctx) }
    71    func (u *{{ $tUnfolder }}) OnFloat32(ctx *unfoldCtx, _ float32) error { return u.onValue(ctx) }
    72    func (u *{{ $tUnfolder }}) OnFloat64(ctx *unfoldCtx, _ float64) error { return u.onValue(ctx) }
    73  
    74    func (u *{{ $tUnfolder }}) OnArrayStart(ctx *unfoldCtx, _ int, _ structform.BaseType) error {
    75      _singletonUnfoldIgnoreArrPtr.initState(ctx, nil)
    76      return nil
    77    }
    78  
    79    func (u *{{ $tUnfolder }}) OnChildArrayDone(ctx *unfoldCtx) error {
    80      return u.onValue(ctx)
    81    }
    82  
    83    func (u *{{ $tUnfolder }}) OnObjectStart(ctx *unfoldCtx, _ int, _ structform.BaseType) error {
    84      _singletonUnfoldIgnoreObjPtr.initState(ctx, nil)
    85      return nil
    86    }
    87  
    88    func (u *{{ $tUnfolder }}) OnChildObjectDone(ctx *unfoldCtx) error {
    89      return u.onValue(ctx)
    90    }