You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: dao.go
    path of file: ./repos/cds/engine/api/permission
    
    the code of the file until where you have to start completion: package permission

import (
	"context"
	"database/sql"
	"strings"

	"github.com/go-gorp/gorp"
	"github.com/lib/pq"

	"github.com/ovh/cds/engine/api/database/gorpmapping"
	"github.com/ovh/cds/engine/api/group"
	"github.com/ovh/cds/sdk"
	"github.com/ovh/cds/sdk/telemetry"
)

func LoadWorkflowMaxLevelPermissionByWorkflowIDs(ctx context.Context, db gorp.SqlExecutor, workflowIDs []int64, groupIDs []int64) (sdk.EntitiesPermissions, error) {
	_, end := telemetry.Span(ctx, "permission.LoadWorkflowMaxLevelPermissionByWorkflowIDs")
	defer end()

	query := `
		SELECT workflow.id::text, max(workflow_perm.role)
		FROM workflow_perm
		JOIN workflow ON workflow.id = workflow_perm.workflow_id
		
    
func LoadWorkflowMaxLevelPermissionByWorkflowIDs(ctx context.Context, db gorp.SqlExecutor, workflowIDs []int64, groupIDs []int64) (sdk.EntitiesPermissions, error) {
	_, end := telemetry.Span(ctx, "permission.LoadWorkflowMaxLevelPermissionByWorkflowIDs")
	defer end()

	query := `
		SELECT workflow.id::text, max(workflow_perm.role)
		FROM workflow_perm
		JOIN workflow ON workflow.id = workflow_perm.workflow_id
		JOIN project ON project.id = workflow.project_id
		JOIN project_group ON project_group.id = workflow_perm.project_group_id
		WHERE project_group.project_id = project.id
		AND workflow.id = ANY($1)
		AND project_group.group_id = ANY($2)
		GROUP BY workflow.id, workflow.name`

	rows, err := db.Query(query, pq.Int64Array(workflowIDs), pq.Int64Array(groupIDs))
	if err == sql.ErrNoRows {
		return nil, nil
	}
	if err != nil {
		return nil, sdk.WithStack(err)
	}
	defer rows.Close()

	return scanPermissions(rows)
}