func (m *MySQL) ListTargets(ctx context.Context) ([]datastore.Target, error) {
	var ts []datastore.Target
	query := `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`
	if err := m.Conn.SelectContext(ctx, &ts, query); err != nil {
		return nil, fmt.Errorf("failed to SELECT query: %w", err)
	}
	return ts, nil
}
ListTargets get a all 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
}
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
}
func (m *MySQL) GetTargetByScope(ctx context.Context, gheDomain, scope string) (*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 scope = "%s"`, scope)
	if gheDomain != "" {
		query = fmt.Sprintf(`%s AND ghe_domain = "%s"`, query, gheDomain)
	}
	if err := m.Conn.GetContext(ctx, &t, query); 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
}