code: func (query Query) Preload(record interface{}, field string) error {
  	path := strings.Split(field, ".")
  
  	rv := reflect.ValueOf(record)
  	if rv.Kind() != reflect.Ptr || rv.IsNil() {
  		panic("grimoire: record parameter must be a pointer.")
  	}
  
  	preload := traversePreloadTarget(rv.Elem(), path)
  	if len(preload) == 0 {
  		return nil
  	}
  
  	schemaType := preload[0].schema.Type()
  	refIndex, fkIndex, column := getPreloadInfo(schemaType, path[len(path)-1])
  
  	addrs, ids := collectPreloadTarget(preload, refIndex)
  	if len(ids) == 0 {
  		return nil
  	}
  
  	// prepare temp result variable for querying
  	rt := preload[0].field.Type()
  	if rt.Kind() == reflect.Slice || rt.Kind() == reflect.Array || rt.Kind() == reflect.Ptr {
  		rt = rt.Elem()
  	}
  
  	slice := reflect.MakeSlice(reflect.SliceOf(rt), 0, len(ids))
  	result := reflect.New(slice.Type())
  	result.Elem().Set(slice)
  
  	// query all records using collected ids.
  	err := query.Where(c.In(c.I(column), ids...)).All(result.Interface())
  	if err != nil {
  		return err
  	}
  
  	// map results.
  	result = result.Elem()
  	for i := 0; i < result.Len(); i++ {
  		curr := result.Index(i)
  		id := getPreloadID(curr.FieldByIndex(fkIndex))
  
  		for _, addr := range addrs[id] {
  			if addr.Kind() == reflect.Slice {
  				addr.Set(reflect.Append(addr, curr))
  			} else if addr.Kind() == reflect.Ptr {
  				currP := reflect.New(curr.Type())
  				currP.Elem().Set(curr)
  				addr.Set(currP)
  			} else {
  				addr.Set(curr)
  			}
  		}
  	}
  
  	return nil
  }
docs: // Preload loads association with given query.