func Union(firstChild *v0.SetOperation_Child, rest ...*v0.SetOperation_Child) *v0.UsersetRewrite {
	return &v0.UsersetRewrite{
		RewriteOperation: &v0.UsersetRewrite_Union{
			Union: setOperation(firstChild, rest),
		},
	}
}
Union creates a rewrite definition that combines/considers usersets in all children.
package namespace
import (
	v0 "github.com/authzed/authzed-go/proto/authzed/api/v0"
	iv1 "github.com/authzed/spicedb/internal/proto/impl/v1"
)
func Namespace(name string, relations ...*v0.Relation) *v0.NamespaceDefinition {
	return &v0.NamespaceDefinition{
		Name:     name,
		Relation: relations,
	}
}
func NamespaceWithComment(name string, comment string, relations ...*v0.Relation) *v0.NamespaceDefinition {
	nd := Namespace(name, relations...)
	nd.Metadata, _ = AddComment(nd.Metadata, comment)
	return nd
}
func Relation(name string, rewrite *v0.UsersetRewrite, allowedDirectRelations ...*v0.RelationReference) *v0.Relation {
	var typeInfo *v0.TypeInformation
	if len(allowedDirectRelations) > 0 {
		typeInfo = &v0.TypeInformation{
			AllowedDirectRelations: allowedDirectRelations,
		}
	}
	rel := &v0.Relation{
		Name:            name,
		UsersetRewrite:  rewrite,
		TypeInformation: typeInfo,
	}
	switch {
	case rewrite != nil && len(allowedDirectRelations) == 0:
		if err := SetRelationKind(rel, iv1.RelationMetadata_PERMISSION); err != nil {
			panic("failed to set relation kind: " + err.Error())
		}
	case rewrite == nil && len(allowedDirectRelations) > 0:
		if err := SetRelationKind(rel, iv1.RelationMetadata_RELATION); err != nil {
			panic("failed to set relation kind: " + err.Error())
		}
	default:
	}
	return rel
}
func RelationWithComment(name string, comment string, rewrite *v0.UsersetRewrite, allowedDirectRelations ...*v0.RelationReference) *v0.Relation {
	rel := Relation(name, rewrite, allowedDirectRelations...)
	rel.Metadata, _ = AddComment(rel.Metadata, comment)
	return rel
}
func RelationReference(namespaceName string, relationName string) *v0.RelationReference {
	return &v0.RelationReference{
		Namespace: namespaceName,
		Relation:  relationName,
	}
}