Exemple #1
0
func newStructSaveTemplate(t reflect.Type) *structSaveTemplate {
	spec := mdl.StructSpecForType(t)
	sst := &structSaveTemplate{
		spec:     spec,
		elemTpls: make([]ActionTemplate, len(spec.Fields)),
	}
	for i, fld := range sst.spec.Fields {
		sst.elemTpls[i] = TCSave.GetTemplate(fld.Typ)
	}
	return sst
}
Exemple #2
0
func newStructFindTemplate(t reflect.Type) *structFindTemplate {
	srtSpec := mdl.StructSpecForType(t)
	sft := &structFindTemplate{
		spec:    srtSpec,
		elemTpl: make([]ActionTemplate, len(srtSpec.Fields)),
	}

	for i, fldSpec := range sft.spec.Fields {
		sft.elemTpl[i] = TCFind.GetTemplate(fldSpec.Typ)
	}
	return sft
}