repositoryimpl

package
v1.6.2-temp Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package repositoryadapter provides an adapter for working with space repositories.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Init added in v1.7.4

func Init(db *gorm.DB, tables *Tables) error

Init initializes the database and sets up the necessary adapters.

func NewProjectRepository

func NewProjectRepository(mapper ProjectMapper) spacerepo.Project

func ProjectAdapter added in v1.7.4

func ProjectAdapter() *projectAdapter

ComputilityAccountRecordAdapter returns the instance of the computilityAccountRecordAdapter.

Types

type ProjectDO

type ProjectDO struct {
	Id            string
	Owner         string
	Name          string
	FL            byte
	Desc          string
	Title         string
	Type          string
	Level         int
	CoverId       string
	Protocol      string
	Training      string
	RepoType      string
	RepoId        string
	Tags          []string
	TagKinds      []string
	CreatedAt     int64
	UpdatedAt     int64
	Version       int
	LikeCount     int
	ForkCount     int
	DownloadCount int

	CommitId           string
	NoApplicationFile  bool
	Exception          string
	CompPowerAllocated bool

	Hardware  string
	BaseImage string

	RelatedModels   []repositories.ResourceIndexDO
	RelatedDatasets []repositories.ResourceIndexDO
}

type ProjectMapper

type ProjectMapper interface {
	Insert(ProjectDO) (string, error)
	Delete(*repositories.ResourceIndexDO) error
	Get(string, string) (ProjectDO, error)
	GetByName(string, string) (ProjectDO, error)
	GetByRepoId(string) (ProjectDO, error)
	GetSummary(string, string) (ProjectResourceSummaryDO, error)
	GetSummaryByName(string, string) (repositories.ResourceSummaryDO, error)

	ListUsersProjects(map[string][]string) ([]ProjectSummaryDO, error)

	ListAndSortByUpdateTime(string, *repositories.ResourceListDO) ([]ProjectSummaryDO, int, error)
	ListAndSortByFirstLetter(string, *repositories.ResourceListDO) ([]ProjectSummaryDO, int, error)
	ListAndSortByDownloadCount(string, *repositories.ResourceListDO) ([]ProjectSummaryDO, int, error)

	ListGlobalAndSortByUpdateTime(*repositories.GlobalResourceListDO) ([]ProjectSummaryDO, int, error)
	ListGlobalAndSortByFirstLetter(*repositories.GlobalResourceListDO) ([]ProjectSummaryDO, int, error)
	ListGlobalAndSortByDownloadCount(*repositories.GlobalResourceListDO) ([]ProjectSummaryDO, int, error)

	Search(do *repositories.GlobalResourceListDO, topNum int) ([]repositories.ResourceSummaryDO, int, error)

	IncreaseFork(repositories.ResourceIndexDO) error
	IncreaseDownload(repositories.ResourceIndexDO) error

	AddLike(repositories.ResourceIndexDO) error
	RemoveLike(repositories.ResourceIndexDO) error

	AddRelatedModel(*repositories.RelatedResourceDO) error
	RemoveRelatedModel(*repositories.RelatedResourceDO) error

	AddRelatedDataset(*repositories.RelatedResourceDO) error
	RemoveRelatedDataset(*repositories.RelatedResourceDO) error

	UpdateProperty(*ProjectPropertyDO) error
}

type ProjectPropertyDO

type ProjectPropertyDO struct {
	repositories.ResourceToUpdateDO

	FL                byte
	Name              string
	Desc              string
	Title             string
	Level             int
	CoverId           string
	RepoType          string
	Tags              []string
	TagKinds          []string
	CommitId          string
	NoApplicationFile bool
	Exception         string
}

type ProjectResourceSummaryDO

type ProjectResourceSummaryDO struct {
	repositories.ResourceSummaryDO

	Tags []string
}

type ProjectSummaryDO

type ProjectSummaryDO struct {
	Id            string
	Owner         string
	Name          string
	Desc          string
	Title         string
	Level         int
	CoverId       string
	Tags          []string
	UpdatedAt     int64
	LikeCount     int
	ForkCount     int
	DownloadCount int
	Hardware      string
	Type          string
}

type Tables added in v1.7.4

type Tables struct {
	Project string `json:"project" required:"true"`
	Tags    string `json:"tags" required:"true"`
	Dataset string `json:"dataset" required:"true"`
	Model   string `json:"model" required:"true"`
}

Tables is a struct that represents tables of space.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL