func BindRelation(content contenttype.ContentTyper) error {
	contentType := content.ContentType()
	def, _ := definition.GetDefinition(contentType)
	if def.HasRelationlist() {
		relationMap := content.(contenttype.GetRelations).GetRelations()
		for identifier, fieldDef := range def.FieldMap {
			if fieldDef.FieldType == "relationlist" {
				if value, ok := relationMap[identifier]; ok {
					err := content.SetValue(identifier, value)
					if err != nil {
						return fmt.Errorf("Error when binding relationlist %v: %w", identifier, err)
					}
				}
			}
		}
	}
	return nil
}
FinishBind sets related data after data binding. It will be better if SQLBoiler support interface for customized  binding for struct.
package query
import (
	"context"
	"fmt"
	"github.com/digimakergo/digimaker/core/contenttype"
	"github.com/digimakergo/digimaker/core/db"
	"github.com/digimakergo/digimaker/core/definition"
	"github.com/digimakergo/digimaker/core/fieldtype"
)
type Querier struct {
}
func (q Querier) Fetch(ctx context.Context, contentType string, condition db.Condition) (contenttype.ContentTyper, error) {
	content := contenttype.NewInstance(contentType)
	condition = condition.Limit(0, 1)
	_, err := db.BindContent(ctx, content, contentType, condition)
	if err != nil {
		return nil, err
	}
	err = q.finishBind(ctx, content)
	if err != nil {
		return nil, err
	}
	if content.GetCID() == 0 {
		return nil, nil
	}
	return content, err
}
func (q Querier) finishBind(ctx context.Context, content contenttype.ContentTyper) error {
	err := BindRelation(content)
	if err != nil {
		return err
	}
	q.washOutput(ctx, content)
	return nil
}
func (q Querier) washOutput(ctx context.Context, content contenttype.ContentTyper) {
	if content != nil {
		def, _ := definition.GetDefinition(content.ContentType())
		for identifier, fieldDef := range def.FieldMap {
			handler := fieldtype.GethHandler(fieldDef)
			if handler != nil {
				if washer, ok := handler.(fieldtype.Outputer); ok {
					value := content.Value(identifier)
					washedValue := washer.Ouput(ctx, q, value)
					content.SetValue(identifier, washedValue)
				}
			}
		}
	}
}
func (Querier) ListWithUser(ctx context.Context, userID int, contentType string, condition db.Condition) ([]contenttype.ContentTyper, int, error) {
	permissionCondition := accessCondition(userID, contentType, ctx)
	condition = condition.And(permissionCondition)
	list, count, err := List(ctx, contentType, condition)
	return list, count, err
}
func (q Querier) List(ctx context.Context, contentType string, condition db.Condition) ([]contenttype.ContentTyper, int, error) {
	contentList := contenttype.NewList(contentType)
	count, err := db.BindContent(ctx, contentList, contentType, condition)
	if err != nil {
		return nil, count, err
	}
	result := contenttype.ToList(contentType, contentList)
	for _, content := range result {
		err = q.finishBind(ctx, content)
		if err != nil {
			return nil, 0, err
		}
	}
	return result, count, err
}
var DefaultQuerier = Querier{}