Documentation ¶
Index ¶
- Constants
- func DeletePackageModel(session *gocql.Session, packageModel *PackageModel) error
- func FindPackageVersions(session *gocql.Session, author string, repo string) ([]string, error)
- func InsertPackage(session *gocql.Session, packageModel *PackageModel) error
- func InsertPackages(session *gocql.Session, packageModels []*PackageModel) error
- func IsPackageArchived(session *gocql.Session, author string, repo string, ref string) bool
- func RecordDailyDownload(session *gocql.Session, author string, repo string, version string) error
- func RecordPackageArchival(session *gocql.Session, author string, repo string, ref string) error
- type PackageModel
- func FuzzySearchPackages(session *gocql.Session, searchText string) ([]*PackageModel, error)
- func NewPackageModelForInsert(author string, exists bool, repo string, versions []string, godocURL string, ...) (*PackageModel, error)
- func NewPackageModelFromBulkSelect(author string, repo string, description string) (*PackageModel, error)
- func NewPackageModelFromSingleSelect(author string, exists bool, repo string, versions []string, godocURL string, ...) (*PackageModel, error)
- func NewPackageModelTest(author string, repo string, awesome_go bool, description string, exists bool, ...) *PackageModel
- func ScanAllPackageModels(session *gocql.Session) ([]*PackageModel, error)
Constants ¶
const ( // TableNamePackages is the name of the table containing the package model. TableNamePackages = "gophr.packages" // IndexNamePackages is the name of the lucene index IndexNamePackages = "packages_index" ColumnNamePackagesRepo = "repo" ColumnNamePackagesStars = "stars" ColumnNamePackagesExists = "exists" ColumnNamePackagesAuthor = "author" ColumnNamePackagesVersions = "versions" ColumnNamePackagesGodocURL = "godoc_url" ColumnNamePackagesIndexTime = "index_time" ColumnNamePackagesAwesomeGo = "awesome_go" ColumnNamePackagesSearchBlob = "search_blob" ColumnNamePackagesDescription = "description" )
Constants directly related to interacting with the package model in the cassandra database.
Variables ¶
This section is empty.
Functions ¶
func DeletePackageModel ¶
func DeletePackageModel(session *gocql.Session, packageModel *PackageModel) error
func FindPackageVersions ¶
FindPackageVersions gets the versions of a package from the database. If no such package exists, or there were no versions for said package, then nil is returned.
func InsertPackage ¶
func InsertPackage( session *gocql.Session, packageModel *PackageModel, ) error
InsertPackage inserts an individual package into the database.
func InsertPackages ¶
func InsertPackages( session *gocql.Session, packageModels []*PackageModel, ) error
InsertPackages inserts a slice of package models into the database.
func IsPackageArchived ¶
IsPackageArchived returns true if a package version matching the parameters exists.
Types ¶
type PackageModel ¶
type PackageModel struct { Repo *string Stars *int Exists *bool Author *string Versions []string GodocURL *string IndexTime *time.Time AwesomeGo *bool SearchBlob *string Description *string }
PackageModel is a struct representing one individual package in the database.
func FuzzySearchPackages ¶
func FuzzySearchPackages( session *gocql.Session, searchText string, ) ([]*PackageModel, error)
FuzzySearchPackages finds a list of packages relevant to a query phrase string. The search takes author, package and description into account.
func NewPackageModelForInsert ¶
func NewPackageModelForInsert( author string, exists bool, repo string, versions []string, godocURL string, indexTime time.Time, awesomeGo bool, description string, stars int, ) (*PackageModel, error)
NewPackageModelForInsert creates an instance of PackageModel that is optimized and validated for the insert operation in the database.
func NewPackageModelFromBulkSelect ¶
func NewPackageModelFromBulkSelect( author string, repo string, description string, ) (*PackageModel, error)
NewPackageModelFromBulkSelect creates an instance of PackageModel that is optimized and validated for a select operation designed to get data about multiple packages from the database.
func NewPackageModelFromSingleSelect ¶
func NewPackageModelFromSingleSelect( author string, exists bool, repo string, versions []string, godocURL string, awesomeGo bool, description string, ) (*PackageModel, error)
NewPackageModelFromSingleSelect creates an instance of PackageModel that is optimized and validated for a select operation designed to get data about a single package from the database.
func NewPackageModelTest ¶
func NewPackageModelTest( author string, repo string, awesome_go bool, description string, exists bool, godoc_url string, index_time time.Time, search_blob string, versions []string, stars int, ) *PackageModel
TODO(Shikkic): Fix func name and attribute naming scheme
func ScanAllPackageModels ¶
func ScanAllPackageModels(session *gocql.Session) ([]*PackageModel, error)