// UnionMemlayout returns a plain string at present;
// there's a case-switch in the templates that processes it.
// We validate that it's a known string when this method is called.
// This should probably be improved in type-safety,
// and validated more aggressively up front when adjcfg is loaded.
UnionMemlayout returns a plain string at present;
there's a case-switch in the templates that processes it.
We validate that it's a known string when this method is called.
This should probably be improved in type-safety,
and validated more aggressively up front when adjcfg is loaded.
// UnionMemlayout returns a plain string at present ; // there ' s a case - switch in the templates that processes it . // We validate that it ' s a known string when this method is called . // This should probably be improved in type - safety // and validated more aggressively up front when adjcfg is loaded .
func (cfg *AdjunctCfg) UnionMemlayout(t schema.Type) string {
	if t.TypeKind() != schema.TypeKind_Union {
		panic(fmt.Errorf("%s is not a union!", t.Name()))
	}
	v, ok := cfg.CfgUnionMemlayout[t.Name()]
	if !ok {
		return "embedAll"
	}
	switch v {
	case "embedAll", "interface":
		return v
	default:
		panic(fmt.Errorf("invalid config: unionMemlayout values must be either \"embedAll\" or \"interface\", not %q", v))
	}
}
func ( cfg * AdjunctCfg ) UnionMemlayout ( t schema . Type ) string { if t . TypeKind ( ) != schema . TypeKind_Union { panic ( fmt . Errorf ( " " , t . Name ( ) ) ) } v , ok := cfg . CfgUnionMemlayout [ t . Name ( ) ] if ! ok { return " " } switch v { case " " , " " : return v default : panic ( fmt . Errorf ( " \" \" \" \" " , v ) ) } }
UnionMemlayout returns a plain string at present;
there's a case-switch in the templates that processes it.
UnionMemlayout returns a plain string at present ; there ' s a case - switch in the templates that processes it .