<commit_before>package models

import (
	"errors"
	"strings"
	"time"

	"github.com/gobuild/gobuild2/pkg/base"
	"github.com/gobuild/gobuild2/pkg/gowalker"
	"github.com/gobuild/log"
)

var (
	ErrRepositoryNotExists = errors.New("repo not found")
)

type Repository struct {
	Id      int64
	Uri     string `xorm:"unique(r)"`
	Brief   string
	IsCgo   bool
	IsCmd   bool
	Tags    []string
	Created time.Time `xorm:"created"`
}

type RepoStatistic struct {
	Rid           int64 `xorm:"pk"`
	Pv            int64
	DownloadCount int64
	Updated       time.Time `xorm:"updated"`
}

type LastRepoUpdate struct {
	Rid        int64  `xorm:"unique(u)"`
	TagBranch  string `xorm:"unique(u)"`
	Os         string `xorm:"unique(u)"`
	Arch       string `xorm:"unique(u)"`
	PushURI    string
	ZipBallUrl string
	Updated    time.Time `xorm:"updated"`
}

func AddRepository(repoName string) (r *Repository, err error) {
	cvsinfo, err := base.ParseCvsURI(repoName) // base.SanitizedRepoPath(rf.Name)
	if err != nil {
		log.Errorf("parse cvs url error: %v", err)
		return
	}
<commit_msg>add download count in repo<commit_after>package models

import (
	"errors"
	"strings"
	"time"

	"github.com/gobuild/gobuild2/pkg/base"
	"github.com/gobuild/gobuild2/pkg/gowalker"
	"github.com/gobuild/log"
)

var (
	ErrRepositoryNotExists = errors.New("repo not found")
)

type Repository struct {
	Id            int64
	Uri           string `xorm:"unique(r)"`
	Brief         string
	IsCgo         bool
	IsCmd         bool
	Tags          []string
	Created       time.Time `xorm:"created"`
	DownloadCount int64
}

type RepoStatistic struct {
	Rid           int64 `xorm:"pk"`
	Pv            int64
	DownloadCount int64
	Updated       time.Time `xorm:"updated"`
}

type LastRepoUpdate struct {
	Rid        int64  `xorm:"unique(u)"`
	TagBranch  string `xorm:"unique(u)"`
	Os         string `xorm:"unique(u)"`
	Arch       string `xorm:"unique(u)"`
	PushURI    string
	ZipBallUrl string
	Updated    time.Time `xorm:"updated"`
}

func AddRepository(repoName string) (r *Repository, err error) {
	cvsinfo, err := base.ParseCvsURI(repoName) // base.SanitizedRepoPath(rf.Name)
	if err != nil {
		log.Errorf("parse cvs url error: %v", err)
		return
	}

{'fraction_non_alphanumeric': 0.12272727272727273, 'fraction_numerical': 0.011818181818181818, 'mean_word_length': 3.1217228464419478, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4351718', 'n_tokens_mistral': 831, 'n_tokens_neox': 815, 'n_words': 184}