func (m *MySQL) GetTarget(ctx context.Context, id uuid.UUID) (*datastore.Target, error) {
	var t datastore.Target
	query := fmt.Sprintf(`SELECT uuid, scope, ghe_domain, github_token, token_expired_at, resource_type, runner_user, runner_version, provider_url, status, status_description, created_at, updated_at FROM targets WHERE uuid = ?`)
	if err := m.Conn.GetContext(ctx, &t, query, id.String()); err != nil {
		if errors.Is(err, sql.ErrNoRows) {
			return nil, datastore.ErrNotFound
		}
		return nil, fmt.Errorf("failed to execute SELECT query: %w", err)
	}
	return &t, nil
}
GetTarget get a target
package mysql
import (
	"context"
	"database/sql"
	"errors"
	"fmt"
	"time"
	uuid "github.com/satori/go.uuid"
	"github.com/whywaita/myshoes/pkg/datastore"
)
func (m *MySQL) CreateTarget(ctx context.Context, target datastore.Target) error {
	expiredAtRFC3339 := target.TokenExpiredAt.Format("2006-01-02 15:04:05")
	query := `INSERT INTO targets(uuid, scope, ghe_domain, github_token, token_expired_at, resource_type, runner_user, runner_version, provider_url) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
	if _, err := m.Conn.ExecContext(
		ctx,
		query,
		target.UUID,
		target.Scope,
		target.GHEDomain,
		target.GitHubToken,
		expiredAtRFC3339,
		target.ResourceType,
		target.RunnerUser,
		target.RunnerVersion,
		target.ProviderURL,
	); err != nil {
		return fmt.Errorf("failed to execute INSERT query: %w", err)
	}
	return nil
}