Your Question

Example:

type T1 struct {
  AnyID uint    // it's T2.id if AnyType=1, otherwise it's T3.id
  AnyType int

  T2 *T2
  T3 *T3
}

type T2 struct {}
type T3 struct {}

Is there a convenient way to preload T2 or T3 table by AnyID and AnyType ?

The document you expected this should be explained

Expected answer

A convenient way to preload multiple tables with one id field

Comment From: a631807682

Since relational definitions do not support expressions, so we dose not support it. Of course, Preload is nothing but a composition function, you can still implement it yourself. https://github.com/go-gorm/gorm/blob/master/callbacks/query.go#L211