github.com/searKing/golang/go@v1.2.117/encoding/internal/tag/ptrTagFunc.go (about) 1 // Copyright 2020 The searKing Author. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 package tag 6 7 import "reflect" 8 9 type ptrTagFunc struct { 10 elemConv tagFunc 11 } 12 13 func (pe *ptrTagFunc) handle(e *tagState, v reflect.Value, opts tagOpts) (isUserDefined bool) { 14 isUserDefined = false 15 if v.IsNil() { 16 return 17 } 18 return pe.elemConv(e, v.Elem(), opts) 19 } 20 21 func newPtrTagFunc(t reflect.Type) tagFunc { 22 tagFn := &ptrTagFunc{typeTagFunc(t.Elem())} 23 return tagFn.handle 24 }