repositories

package
v0.0.0-...-d7fecdb Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2023 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertError

func ConvertError(err error) (out error)

convertError

func NewAIQuestionRepository

func NewAIQuestionRepository(mapper AIQuestionMapper) repository.AIQuestion

func NewActivityRepository

func NewActivityRepository(mapper ActivityMapper) repository.Activity

func NewCompetitionRepository

func NewCompetitionRepository(mapper CompetitionMapper) repository.Competition

func NewDatasetRepository

func NewDatasetRepository(mapper DatasetMapper) repository.Dataset

func NewErrorConcurrentUpdating

func NewErrorConcurrentUpdating(err error) errorConcurrentUpdating

func NewErrorDataNotExists

func NewErrorDataNotExists(err error) errorDataNotExists

func NewErrorDuplicateCreating

func NewErrorDuplicateCreating(err error) errorDuplicateCreating

func NewFinetuneRepository

func NewFinetuneRepository(mapper FinetuneMapper) repository.Finetune

func NewInferenceRepository

func NewInferenceRepository(mapper InferenceMapper) repository.Inference

func NewLikeRepository

func NewLikeRepository(mapper LikeMapper) repository.Like

func NewLoginRepository

func NewLoginRepository(mapper LoginMapper) repository.Login

TODO: mapper can be mysql

func NewLuoJiaRepository

func NewLuoJiaRepository(mapper LuoJiaMapper) repository.LuoJia

func NewModelRepository

func NewModelRepository(mapper ModelMapper) repository.Model

func NewProjectRepository

func NewProjectRepository(mapper ProjectMapper) repository.Project

func NewTagsRepository

func NewTagsRepository(mapper TagsMapper) repository.Tags

func NewTrainingRepository

func NewTrainingRepository(mapper TrainingMapper) repository.Training

func NewWuKongPictureRepository

func NewWuKongPictureRepository(mapper WuKongPictureMapper) repository.WuKongPicture

func NewWuKongRepository

func NewWuKongRepository(mapper WuKongMapper) repository.WuKong

Types

type AIQuestionMapper

type AIQuestionMapper interface {
	GetCompetitorAndSubmission(string, string) (
		bool, int, QuestionSubmissionDO, error,
	)

	SaveCompetitor(string, *CompetitorInfoDO) error

	InsertSubmission(string, *QuestionSubmissionDO) (string, error)
	UpdateSubmission(string, *QuestionSubmissionDO) error
	GetSubmission(qid, competitor, date string) (QuestionSubmissionDO, error)

	GetQuestions(pool string, choice, completion []int) (
		[]ChoiceQuestionDO,
		[]CompletionQuestionDO, error,
	)

	GetResult(string) ([]QuestionSubmissionInfoDO, error)
}

type Access

type Access interface {
	Insert(key, value string) error
	Get(key string) (string, error)
	Expire(key string, expire int64) error
}

func NewAccessRepo

func NewAccessRepo(expireDuration int) Access

type ActivityDO

type ActivityDO struct {
	Type string
	Time int64

	RepoType string

	ResourceObjectDO
}

type ActivityListDO

type ActivityListDO struct {
}

type ActivityMapper

type ActivityMapper interface {
	Insert(string, ActivityDO) error
	List(string, ActivityListDO) ([]ActivityDO, error)
}

type ChoiceQuestionDO

type ChoiceQuestionDO = domain.ChoiceQuestion

type CompetitionDO

type CompetitionDO struct {
	CompetitionSummaryDO

	Enabled    bool
	Type       string
	Phase      string
	Doc        string
	Forum      string
	Winners    string
	DatasetDoc string
	DatasetURL string
}

type CompetitionIndexDO

type CompetitionIndexDO struct {
	Id    string
	Phase string
}

type CompetitionListOptionDO

type CompetitionListOptionDO struct {
	Phase      string
	Status     string
	Competitor string
}

type CompetitionRepoDO

type CompetitionRepoDO struct {
	TeamId     string
	Individual string

	Owner string
	Repo  string
}

type CompetitionSubmissionDO

type CompetitionSubmissionDO struct {
	Id         string
	TeamId     string
	Individual string

	SubmitAt int64
	OBSPath  string
	Status   string
	Score    float32
}

type CompetitionSubmissionInfoDO

type CompetitionSubmissionInfoDO = domain.CompetitionSubmissionInfo

type CompetitionSummaryDO

type CompetitionSummaryDO struct {
	Bonus    int
	Id       string
	Name     string
	Desc     string
	Host     string
	Status   string
	Poster   string
	Duration string

	CompetitorsCount int
}

type CompetitionTeamDO

type CompetitionTeamDO struct {
	Id   string
	Name string
}

type CompetitorDO

type CompetitorDO struct {
	CompetitorInfoDO

	TeamId   string
	TeamRole string
	TeamName string
}

type CompetitorInfoDO

type CompetitorInfoDO struct {
	Account  string
	Name     string
	City     string
	Email    string
	Phone    string
	Identity string
	Province string
	Detail   map[string]string
}

type CompetitorSummaryDO

type CompetitorSummaryDO struct {
	IsCompetitor bool
	TeamId       string
	TeamRole     string
}

type CompletionQuestionDO

type CompletionQuestionDO = domain.CompletionQuestion

type ComputeDO

type ComputeDO struct {
	Type    string
	Flavor  string
	Version string
}

type DatasetDO

type DatasetDO struct {
	Id            string
	Owner         string
	Name          string
	FL            byte
	Desc          string
	Title         string
	Protocol      string
	RepoType      string
	RepoId        string
	Tags          []string
	TagKinds      []string
	CreatedAt     int64
	UpdatedAt     int64
	Version       int
	LikeCount     int
	DownloadCount int

	RelatedModels   []ResourceIndexDO
	RelatedProjects []ResourceIndexDO
}

type DatasetMapper

type DatasetMapper interface {
	Insert(DatasetDO) (string, error)
	Delete(*ResourceIndexDO) error
	Get(string, string) (DatasetDO, error)
	GetByName(string, string) (DatasetDO, error)
	GetSummaryByName(string, string) (ResourceSummaryDO, error)

	ListUsersDatasets(map[string][]string) ([]DatasetSummaryDO, error)
	ListSummary(map[string][]string) ([]ResourceSummaryDO, error)

	ListAndSortByUpdateTime(string, *ResourceListDO) ([]DatasetSummaryDO, int, error)
	ListAndSortByFirstLetter(string, *ResourceListDO) ([]DatasetSummaryDO, int, error)
	ListAndSortByDownloadCount(string, *ResourceListDO) ([]DatasetSummaryDO, int, error)

	ListGlobalAndSortByUpdateTime(*GlobalResourceListDO) ([]DatasetSummaryDO, int, error)
	ListGlobalAndSortByFirstLetter(*GlobalResourceListDO) ([]DatasetSummaryDO, int, error)
	ListGlobalAndSortByDownloadCount(*GlobalResourceListDO) ([]DatasetSummaryDO, int, error)

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

	IncreaseDownload(ResourceIndexDO) error

	AddLike(ResourceIndexDO) error
	RemoveLike(ResourceIndexDO) error

	AddRelatedProject(*ReverselyRelatedResourceInfoDO) error
	RemoveRelatedProject(*ReverselyRelatedResourceInfoDO) error

	AddRelatedModel(*ReverselyRelatedResourceInfoDO) error
	RemoveRelatedModel(*ReverselyRelatedResourceInfoDO) error

	UpdateProperty(*DatasetPropertyDO) error
}

type DatasetPropertyDO

type DatasetPropertyDO struct {
	ResourceToUpdateDO

	FL       byte
	Name     string
	Desc     string
	Title    string
	RepoType string
	Tags     []string
	TagKinds []string
}

type DatasetSummaryDO

type DatasetSummaryDO struct {
	Id            string
	Owner         string
	Name          string
	Desc          string
	Title         string
	Tags          []string
	UpdatedAt     int64
	LikeCount     int
	DownloadCount int
}

type DomainTagsDo

type DomainTagsDo = domain.DomainTags

type FinetuneConfigDO

type FinetuneConfigDO struct {
	Name            string
	Task            string
	Model           string
	Hyperparameters map[string]string
}

type FinetuneDetailDO

type FinetuneDetailDO struct {
	Id        string
	CreatedAt int64

	FinetuneConfigDO

	Job       FinetuneJobInfoDO
	JobDetail FinetuneJobDetailDO
}

type FinetuneIndexDO

type FinetuneIndexDO struct {
	Id    string
	Owner string
}

type FinetuneJobDO

type FinetuneJobDO = domain.FinetuneJob

type FinetuneJobDetailDO

type FinetuneJobDetailDO = domain.FinetuneJobDetail

type FinetuneJobInfoDO

type FinetuneJobInfoDO = domain.FinetuneJobInfo

type FinetuneMapper

type FinetuneMapper interface {
	Delete(*FinetuneIndexDO) error
	Insert(*UserFinetuneDO, int) (string, error)
	Get(*FinetuneIndexDO) (FinetuneDetailDO, error)
	List(user string) (UserFinetunesDO, int, error)

	GetJob(*FinetuneIndexDO) (FinetuneJobDO, error)
	UpdateJobInfo(*FinetuneIndexDO, *FinetuneJobInfoDO) error
	UpdateJobDetail(*FinetuneIndexDO, *FinetuneJobDetailDO) error
}

type FinetuneSummaryDO

type FinetuneSummaryDO struct {
	Id        string
	Name      string
	CreatedAt int64

	FinetuneJobDetailDO
}

type GlobalResourceListDO

type GlobalResourceListDO struct {
	ResourceListDO
	Level    int
	Tags     []string
	TagKinds []string
}

type InferenceDO

type InferenceDO struct {
	Id           string
	ProjectId    string
	LastCommit   string
	ProjectName  string
	ProjectOwner string

	InferenceDetailDO
}

type InferenceDetailDO

type InferenceDetailDO = domain.InferenceDetail

type InferenceIndexDO

type InferenceIndexDO struct {
	Id         string
	LastCommit string
	Project    ResourceIndexDO
}

type InferenceMapper

type InferenceMapper interface {
	Insert(*InferenceDO, int) (string, error)
	Get(*InferenceIndexDO) (InferenceSummaryDO, error)
	UpdateDetail(*InferenceIndexDO, *InferenceDetailDO) error
	List(*ResourceIndexDO, string) ([]InferenceSummaryDO, int, error)
}

type InferenceSummaryDO

type InferenceSummaryDO struct {
	Id string

	InferenceDetailDO
}

type InputDO

type InputDO struct {
	Key    string
	User   string
	Type   string
	RepoId string
	File   string
}

type KeyValueDO

type KeyValueDO struct {
	Key   string
	Value string
}

type LikeDO

type LikeDO struct {
	CreatedAt int64

	ResourceObjectDO
}

type LikeListDO

type LikeListDO struct {
}

type LikeMapper

type LikeMapper interface {
	Insert(string, LikeDO) error
	Delete(string, LikeDO) error
	List(string, LikeListDO) ([]LikeDO, error)
	HasLike(string, *ResourceObjectDO) (bool, error)
}

type LoginDO

type LoginDO struct {
	Account string
	Info    string
	Email   string
	UserId  string
}

type LoginMapper

type LoginMapper interface {
	Insert(LoginDO) error
	Get(string) (LoginDO, error)
}

type LuoJiaMapper

type LuoJiaMapper interface {
	Insert(*UserLuoJiaRecordDO) (string, error)
	List(string) ([]LuoJiaRecordDO, error)
}

type LuoJiaRecordDO

type LuoJiaRecordDO struct {
	Id        string
	CreatedAt int64
}

type LuoJiaRecordIndexDO

type LuoJiaRecordIndexDO struct {
	User string
	Id   string
}

type ModelDO

type ModelDO struct {
	Id            string
	Owner         string
	Name          string
	FL            byte
	Desc          string
	Title         string
	Protocol      string
	RepoType      string
	RepoId        string
	Tags          []string
	TagKinds      []string
	CreatedAt     int64
	UpdatedAt     int64
	Version       int
	LikeCount     int
	DownloadCount int

	RelatedDatasets []ResourceIndexDO
	RelatedProjects []ResourceIndexDO
}

type ModelMapper

type ModelMapper interface {
	Insert(ModelDO) (string, error)
	Delete(*ResourceIndexDO) error
	Get(string, string) (ModelDO, error)
	GetByName(string, string) (ModelDO, error)
	GetSummaryByName(string, string) (ResourceSummaryDO, error)

	ListUsersModels(map[string][]string) ([]ModelSummaryDO, error)
	ListSummary(map[string][]string) ([]ResourceSummaryDO, error)

	ListAndSortByUpdateTime(string, *ResourceListDO) ([]ModelSummaryDO, int, error)
	ListAndSortByFirstLetter(string, *ResourceListDO) ([]ModelSummaryDO, int, error)
	ListAndSortByDownloadCount(string, *ResourceListDO) ([]ModelSummaryDO, int, error)

	ListGlobalAndSortByUpdateTime(*GlobalResourceListDO) ([]ModelSummaryDO, int, error)
	ListGlobalAndSortByFirstLetter(*GlobalResourceListDO) ([]ModelSummaryDO, int, error)
	ListGlobalAndSortByDownloadCount(*GlobalResourceListDO) ([]ModelSummaryDO, int, error)

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

	IncreaseDownload(ResourceIndexDO) error

	AddLike(ResourceIndexDO) error
	RemoveLike(ResourceIndexDO) error

	AddRelatedDataset(*RelatedResourceDO) error
	RemoveRelatedDataset(*RelatedResourceDO) error

	AddRelatedProject(*ReverselyRelatedResourceInfoDO) error
	RemoveRelatedProject(*ReverselyRelatedResourceInfoDO) error

	UpdateProperty(*ModelPropertyDO) error
}

type ModelPropertyDO

type ModelPropertyDO struct {
	ResourceToUpdateDO

	FL       byte
	Name     string
	Desc     string
	Title    string
	RepoType string
	Tags     []string
	TagKinds []string
}

type ModelSummaryDO

type ModelSummaryDO struct {
	Id            string
	Owner         string
	Name          string
	Desc          string
	Title         string
	Tags          []string
	UpdatedAt     int64
	LikeCount     int
	DownloadCount int
}

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

	RelatedModels   []ResourceIndexDO
	RelatedDatasets []ResourceIndexDO
}

type ProjectMapper

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

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

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

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

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

	IncreaseFork(ResourceIndexDO) error
	IncreaseDownload(ResourceIndexDO) error

	AddLike(ResourceIndexDO) error
	RemoveLike(ResourceIndexDO) error

	AddRelatedModel(*RelatedResourceDO) error
	RemoveRelatedModel(*RelatedResourceDO) error

	AddRelatedDataset(*RelatedResourceDO) error
	RemoveRelatedDataset(*RelatedResourceDO) error

	UpdateProperty(*ProjectPropertyDO) error
}

type ProjectPropertyDO

type ProjectPropertyDO struct {
	ResourceToUpdateDO

	FL       byte
	Name     string
	Desc     string
	Title    string
	Level    int
	CoverId  string
	RepoType string
	Tags     []string
	TagKinds []string
}

type ProjectResourceSummaryDO

type ProjectResourceSummaryDO struct {
	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
}

type QuestionSubmissionDO

type QuestionSubmissionDO struct {
	Id      string
	Account string
	Date    string
	Status  string
	Expiry  int64
	Score   int
	Times   int
	Version int
}

type QuestionSubmissionInfoDO

type QuestionSubmissionInfoDO struct {
	Account string
	Score   int
}

type RelatedResourceDO

type RelatedResourceDO struct {
	ResourceToUpdateDO

	ResourceOwner string
	ResourceId    string
}

type ResourceIndexDO

type ResourceIndexDO struct {
	Owner string
	Id    string
}

type ResourceListDO

type ResourceListDO struct {
	Name         string
	RepoType     []string
	PageNum      int
	CountPerPage int
}

type ResourceObjectDO

type ResourceObjectDO struct {
	Owner string
	Type  string
	Id    string
}

type ResourceSummaryDO

type ResourceSummaryDO struct {
	Owner    string
	Name     string
	Id       string
	RepoId   string
	RepoType string
}

type ResourceToUpdateDO

type ResourceToUpdateDO struct {
	Id        string
	Owner     string
	Version   int
	UpdatedAt int64
}

type ReverselyRelatedResourceInfoDO

type ReverselyRelatedResourceInfoDO struct {
	Promoter ResourceIndexDO
	Resource ResourceIndexDO
}

type TagsDo

type TagsDo = domain.Tags

type TagsMapper

type TagsMapper interface {
	List([]string) ([]DomainTagsDo, error)
}

type TrainingConfigDO

type TrainingConfigDO struct {
	ProjectName   string
	ProjectRepoId string

	Name string
	Desc string

	CodeDir  string
	BootFile string

	Hyperparameters []KeyValueDO
	Env             []KeyValueDO
	Inputs          []InputDO
	EnableAim       bool
	EnableOutput    bool

	Compute ComputeDO
}

type TrainingDetailDO

type TrainingDetailDO struct {
	TrainingConfigDO

	Job       TrainingJobInfoDO
	JobDetail TrainingJobDetailDO
	CreatedAt int64
}

type TrainingIndexDO

type TrainingIndexDO struct {
	User       string
	ProjectId  string
	TrainingId string
}

type TrainingJobDetailDO

type TrainingJobDetailDO = domain.JobDetail

type TrainingJobInfoDO

type TrainingJobInfoDO = domain.JobInfo

type TrainingMapper

type TrainingMapper interface {
	Insert(*UserTrainingDO, int) (string, error)
	Delete(*TrainingIndexDO) error
	Get(*TrainingIndexDO) (TrainingDetailDO, error)
	GetTrainingConfig(*TrainingIndexDO) (TrainingConfigDO, error)
	List(user, projectId string) ([]TrainingSummaryDO, int, error)
	UpdateJobInfo(*TrainingIndexDO, *TrainingJobInfoDO) error
	GetJobInfo(*TrainingIndexDO) (TrainingJobInfoDO, error)
	UpdateJobDetail(*TrainingIndexDO, *TrainingJobDetailDO) error
	GetJobDetail(*TrainingIndexDO) (TrainingJobDetailDO, string, error)
}

type TrainingSummaryDO

type TrainingSummaryDO struct {
	Id        string
	Name      string
	Desc      string
	Error     string
	Status    string
	Duration  int
	CreatedAt int64
}

type UserFinetuneDO

type UserFinetuneDO struct {
	FinetuneIndexDO

	FinetuneConfigDO

	CreatedAt int64
}

type UserFinetunesDO

type UserFinetunesDO struct {
	Expiry int64

	Datas []FinetuneSummaryDO
}

type UserLuoJiaRecordDO

type UserLuoJiaRecordDO struct {
	User string

	LuoJiaRecordDO
}

type UserTrainingDO

type UserTrainingDO struct {
	Id        string
	Owner     string
	ProjectId string

	TrainingConfigDO

	CreatedAt int64
}

type WuKongMapper

type WuKongMapper interface {
	ListSamples(string, []int) ([]string, error)
}

type WuKongPictureDO

type WuKongPictureDO struct {
	Id        string
	Owner     string
	OBSPath   string
	Level     int
	Diggs     []string
	DiggCount int
	Version   int
	CreatedAt string

	WuKongPictureMetaDO
}

type WuKongPictureListOptionDO

type WuKongPictureListOptionDO = repository.WuKongPictureListOption

type WuKongPictureMapper

type WuKongPictureMapper interface {
	GetVersion(string) (int, error)
	ListLikesByUserName(string) ([]WuKongPictureDO, int, error)
	ListPublicsByUserName(string) ([]WuKongPictureDO, int, error)
	InsertIntoLikes(string, *WuKongPictureDO, int) (string, error)
	InsertIntoPublics(string, *WuKongPictureDO, int) (string, error)
	DeleteLike(string, string) error
	DeletePublic(string, string) error
	GetLikeByUserName(string, string) (WuKongPictureDO, error)
	GetPublicByUserName(string, string) (WuKongPictureDO, error)
	GetPublicsGlobal() ([]WuKongPictureDO, error)
	UpdatePublicPicture(string, string, int, *WuKongPictureDO) error
}

type WuKongPictureMetaDO

type WuKongPictureMetaDO struct {
	Style string
	Desc  string
}

Jump to

Keyboard shortcuts

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