github.com/trim21/go-phpserialize@v0.0.22-0.20240301204449-2fca0319b3f0/internal/encoder/struct_reflect.go (about)

     1  package encoder
     2  
     3  import (
     4  	"reflect"
     5  
     6  	"github.com/trim21/go-phpserialize/internal/runtime"
     7  )
     8  
     9  func reflectStruct(ctx *Ctx, b []byte, rv reflect.Value, p uintptr) ([]byte, error) {
    10  	enc, err := compileWithCache(runtime.Type2RType(rv.Type()))
    11  	if err != nil {
    12  		return nil, err
    13  	}
    14  
    15  	return enc(ctx, b, p)
    16  }