``` // create base request with default option...
# spicedb
Copy code
// create base request with default options (optional fields here are strings; they can be filled even if they were not passed)
    req := pb.RelationshipFilter{
        ResourceType: string(relation.ResourceType),
        OptionalResourceId: relation.ResourceID,
        OptionalRelation: string(relation.Relation),

    // conditionally include a subject filter if values were passed
    if relation.SubjectType != "" {
        // include the subject information
        req.OptionalSubjectFilter = &pb.SubjectFilter{
            SubjectType: string(relation.SubjectType),
            OptionalSubjectId: relation.SubjectID,

    // execute permission removal call
    res, err := db.DB.DeleteRelationships(context.TODO(), &pb.DeleteRelationshipsRequest{ RelationshipFilter: &req })