func (t *Target) CanReceiveJob() bool {
	switch t.Status {
	case TargetStatusSuspend, TargetStatusDeleted:
		return false
	}
	return true
}
CanReceiveJob check status in target
package datastore
import (
	"context"
	"database/sql"
	"errors"
	"fmt"
	"net/url"
	"strings"
	"time"
	"github.com/hashicorp/go-version"
	uuid "github.com/satori/go.uuid"
	"github.com/whywaita/myshoes/pkg/gh"
	"github.com/whywaita/myshoes/pkg/logger"
)
var (
	ErrNotFound = errors.New("not found")
)
var (
	IsLocked    = "is locked"
	IsNotLocked = "is not locked"
)
type Datastore interface {
	CreateTarget(ctx context.Context, target Target) error
	GetTarget(ctx context.Context, id uuid.UUID) (*Target, error)
	GetTargetByScope(ctx context.Context, gheDomain, scope string) (*Target, error)
	ListTargets(ctx context.Context) ([]Target, error)
	DeleteTarget(ctx context.Context, id uuid.UUID) error
	UpdateTargetStatus(ctx context.Context, targetID uuid.UUID, newStatus TargetStatus, description string) error
	UpdateToken(ctx context.Context, targetID uuid.UUID, newToken string, newExpiredAt time.Time) error
	UpdateTargetParam(ctx context.Context, targetID uuid.UUID, newResourceType ResourceType, newRunnerVersion, newRunnerUser, newProviderURL sql.NullString) error
	EnqueueJob(ctx context.Context, job Job) error
	ListJobs(ctx context.Context) ([]Job, error)
	DeleteJob(ctx context.Context, id uuid.UUID) error
	CreateRunner(ctx context.Context, runner Runner) error
	ListRunners(ctx context.Context) ([]Runner, error)
	GetRunner(ctx context.Context, id uuid.UUID) (*Runner, error)
	DeleteRunner(ctx context.Context, id uuid.UUID, deletedAt time.Time, reason RunnerStatus) error
	GetLock(ctx context.Context) error
	IsLocked(ctx context.Context) (string, error)
}
type Target struct {
	UUID              uuid.UUID      `db:"uuid" json:"id"`
	Scope             string         `db:"scope" json:"scope"`  
	GitHubToken       string         `db:"github_token" json:"github_token"`
	TokenExpiredAt    time.Time      `db:"token_expired_at" json:"token_expired_at"`
	GHEDomain         sql.NullString `db:"ghe_domain" json:"ghe_domain"`
	ResourceType      ResourceType   `db:"resource_type" json:"resource_type"`
	RunnerUser        sql.NullString `db:"runner_user" json:"runner_user"`
	RunnerVersion     sql.NullString `db:"runner_version" json:"runner_version"`
	ProviderURL       sql.NullString `db:"provider_url" json:"provider_url"`
	Status            TargetStatus   `db:"status" json:"status"`
	StatusDescription sql.NullString `db:"status_description" json:"status_description"`
	CreatedAt         time.Time      `db:"created_at" json:"created_at"`
	UpdatedAt         time.Time      `db:"updated_at" json:"updated_at"`
}
func (t *Target) RepoURL() string {
	serverURL := "https://github.com"
	if t.GHEDomain.Valid {
		serverURL = t.GHEDomain.String
	}
	s := strings.Split(serverURL, "://")
	var u url.URL
	u.Scheme = s[0]
	u.Host = s[1]
	u.Path = t.Scope
	return u.String()
}
func (t *Target) OwnerRepo() (string, string) {
	return gh.DivideScope(t.Scope)
}