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_key.go
    path of file: ./repos/cds/engine/api/project
    
    the code of the file until where you have to start completion: package project

import (
	"context"

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

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

// InsertKey a new project key in database
func InsertKey(db gorpmapper.SqlExecutorWithTx, key *sdk.ProjectKey) error {
	var dbProjKey = dbProjectKey{ProjectKey: *key}
	if err := gorpmapping.InsertAndSign(context.Background(), db, &dbProjKey); err != nil {

    
func loadAllKeysForProjects(ctx context.Context, db gorp.SqlExecutor, appsID []int64, opts ...gorpmapping.GetOptionFunc) (map[int64][]sdk.ProjectKey, error) {
	var res []dbProjectKey
	query := gorpmapping.NewQuery(`
		SELECT *
		FROM project_key
		WHERE project_id = ANY($1)
		AND builtin = false
		ORDER BY project_id
	`).Args(pq.Int64Array(appsID))
	if err := gorpmapping.GetAll(ctx, db, query, &res, opts...); err != nil {
		return nil, err
	}

	projsKeys := make(map[int64][]sdk.ProjectKey)

	for i := range res {
		dbProjKey := res[i]
		isValid, err := gorpmapping.CheckSignature(dbProjKey, dbProjKey.Signature)
		if err != nil {
			return nil, err
		}
		if !isValid {
			log.Error(ctx, "project.loadAllKeysForProjects> project key id %d data corrupted", dbProjKey.ID)
			continue
		}
		if _, ok := projsKeys[dbProjKey.ProjectID]; !ok {
			projsKeys[dbProjKey.ProjectID] = make([]sdk.ProjectKey, 0)
		}
		projsKeys[dbProjKey.ProjectID] = append(projsKeys[dbProjKey.ProjectID], dbProjKey.ProjectKey)
	}
	return projsKeys, nil
}