persister

package
v0.0.0-...-f61b284 Latest Latest
Warning

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

Go to latest
Published: Jan 15, 2024 License: BSD-3-Clause Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	SqliteDB   = "./data/gerardus.db"
	RepoURLArg = "repo_url"
)

Variables

View Source
var (
	ErrFailedToInsertSpec     = serr.New("failed to insert Spec")
	ErrFailedWhilePersisting  = serr.New("failed while persisting")
	ErrInvalidGitHubRepoURL   = serr.New("invalid Github URL").ValidArgs("repo_url")
	ErrHTTPRequestFailed      = serr.New("failed HTTP request").ValidArgs("status_code", "request_url")
	ErrValueCannotBeEmpty     = serr.New("value cannot be empty").ValidArgs("which_value")
	ErrFailedConvertToAbsPath = serr.New("failed to convert to absolute path").ValidArgs("filepath")
	ErrFailedToInitDataStore  = serr.New("failed to initialize data store").ValidArgs("data_file")

	ErrFailedToReadHTTPResponseBody = serr.New("failed to read HTTP response body").ValidArgs("request_url")
	ErrFailedToUnmarshalJSON        = serr.New("failed to unmarshal the JSON").ValidArgs("source")
)
View Source
var StdErrWriter io.Writer = os.Stderr

Functions

func Close

func Close(c io.Closer, f func(err error))

func ComposeCodebaseSourceURL

func ComposeCodebaseSourceURL(repoURL, versionTag string) (url string, err error)

func DDL

func DDL() string

func WarnOnError

func WarnOnError(err error)

Types

type Category

type Category struct {
	ID       int64
	SurveyID int64
	Name     string
}

type CategoryType

type CategoryType struct {
	ID         int64
	Name       string
	CategoryID int64
	SurveyID   int64
	TypeID     int64
}

type Codebase

type Codebase struct {
	ID         int64
	ProjectID  int64
	VersionTag string
	SourceUrl  string
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type DataStore

type DataStore interface {
	Open() error
	Query(ctx context.Context, sql string) error
	DB() *sql.DB
	Initialize(ctx context.Context) error
	Queries() DataStoreQueries
	SetQueries(DataStoreQueries)
}

func Initialize

func Initialize(ctx context.Context, fp string, types ...any) (ds DataStore, err error)

func NewSqliteDataStore

func NewSqliteDataStore(dbFile string) DataStore

type DataStoreQueries

type DataStoreQueries interface {
	WithTx(tx *sql.Tx) *Queries
	DeleteCategory(ctx context.Context, id int64) error
	DeleteCodebase(ctx context.Context, id int64) error
	DeleteCodebaseByProjectIdAndVersionTag(ctx context.Context, arg DeleteCodebaseByProjectIdAndVersionTagParams) error
	DeleteCodebaseSurveys(ctx context.Context, codebaseID int64) error
	DeleteFile(ctx context.Context, id int64) error
	DeleteImport(ctx context.Context, id int64) error
	DeleteMethod(ctx context.Context, id int64) error
	DeleteModule(ctx context.Context, id int64) error
	DeleteModuleVersion(ctx context.Context, id int64) error
	DeletePackage(ctx context.Context, id int64) error
	DeletePackageType(ctx context.Context, id int64) error
	DeletePackageVersion(ctx context.Context, id int64) error
	DeleteProject(ctx context.Context, id int64) error
	DeleteProjectByName(ctx context.Context, name string) error
	DeleteSurvey(ctx context.Context, id int64) error
	DeleteSurveyModule(ctx context.Context, id int64) error
	DeleteSymbolType(ctx context.Context, id int64) error
	DeleteType(ctx context.Context, id int64) error
	DeleteVariable(ctx context.Context, id int64) error
	InsertCategory(ctx context.Context, arg InsertCategoryParams) (Category, error)
	InsertCodebase(ctx context.Context, arg InsertCodebaseParams) (Codebase, error)
	InsertFile(ctx context.Context, arg InsertFileParams) (File, error)
	InsertImport(ctx context.Context, arg InsertImportParams) (Import, error)
	InsertMethod(ctx context.Context, arg InsertMethodParams) (Method, error)
	InsertModule(ctx context.Context, name string) (Module, error)
	InsertModuleVersion(ctx context.Context, arg InsertModuleVersionParams) (ModuleVersion, error)
	InsertPackage(ctx context.Context, arg InsertPackageParams) (Package, error)
	InsertPackageType(ctx context.Context, arg InsertPackageTypeParams) (PackageType, error)
	InsertPackageVersion(ctx context.Context, arg InsertPackageVersionParams) (PackageVersion, error)
	InsertProject(ctx context.Context, arg InsertProjectParams) (Project, error)
	InsertSurvey(ctx context.Context, arg InsertSurveyParams) (Survey, error)
	InsertSurveyModule(ctx context.Context, arg InsertSurveyModuleParams) (SurveyModule, error)
	InsertSymbolType(ctx context.Context, arg InsertSymbolTypeParams) (SymbolType, error)
	InsertType(ctx context.Context, arg InsertTypeParams) (Type, error)
	InsertVariable(ctx context.Context, arg InsertVariableParams) (Variable, error)
	ListCategories(ctx context.Context) ([]Category, error)
	ListCodebaseSurveys(ctx context.Context, codebaseID int64) ([]Survey, error)
	ListCodebases(ctx context.Context) ([]Codebase, error)
	ListFiles(ctx context.Context) ([]File, error)
	ListFilesBySurvey(ctx context.Context, surveyID int64) ([]File, error)
	ListImports(ctx context.Context) ([]Import, error)
	ListMethods(ctx context.Context) ([]Method, error)
	ListModuleVersions(ctx context.Context) ([]ModuleVersion, error)
	ListModules(ctx context.Context) ([]Module, error)
	ListPackageTypes(ctx context.Context) ([]PackageType, error)
	ListPackageTypesByName(ctx context.Context) ([]PackageType, error)
	ListPackageVersions(ctx context.Context) ([]PackageVersion, error)
	ListPackages(ctx context.Context) ([]Package, error)
	ListProjects(ctx context.Context) ([]Project, error)
	ListSurveyModules(ctx context.Context) ([]SurveyModule, error)
	ListSurveys(ctx context.Context) ([]ListSurveysRow, error)
	ListSymbolTypes(ctx context.Context) ([]SymbolType, error)
	ListSymbolTypesByName(ctx context.Context) ([]SymbolType, error)
	ListTypes(ctx context.Context) ([]TypeView, error)
	ListTypesByFile(ctx context.Context, fileID int64) ([]TypeView, error)
	ListTypesBySurvey(ctx context.Context, surveyID int64) ([]TypeView, error)
	ListVariables(ctx context.Context) ([]Variable, error)
	LoadCategory(ctx context.Context, id int64) (Category, error)
	LoadCodebase(ctx context.Context, id int64) (Codebase, error)
	LoadCodebaseIDByProjectAndVersion(ctx context.Context, arg LoadCodebaseIDByProjectAndVersionParams) (int64, error)
	LoadCodebaseIdByRepoURL(ctx context.Context, repoUrl string) (int64, error)
	LoadFile(ctx context.Context, id int64) (File, error)
	LoadImport(ctx context.Context, id int64) (Import, error)
	LoadMethod(ctx context.Context, id int64) (Method, error)
	LoadModule(ctx context.Context, id int64) (Module, error)
	LoadModuleVersion(ctx context.Context, id int64) (ModuleVersion, error)
	LoadPackage(ctx context.Context, id int64) (Package, error)
	LoadPackageType(ctx context.Context, id int64) (PackageType, error)
	LoadPackageVersion(ctx context.Context, id int64) (PackageVersion, error)
	LoadProject(ctx context.Context, id int64) (Project, error)
	LoadProjectByName(ctx context.Context, name string) (Project, error)
	LoadProjectByRepoURL(ctx context.Context, repoUrl string) (Project, error)
	LoadProjectRepoURL(ctx context.Context, id int64) (string, error)
	LoadSurvey(ctx context.Context, id int64) (Survey, error)
	LoadSurveyByRepoURL(ctx context.Context, repoUrl string) (LoadSurveyByRepoURLRow, error)
	LoadSurveyModule(ctx context.Context, id int64) (SurveyModule, error)
	LoadSymbolType(ctx context.Context, id int64) (SymbolType, error)
	LoadType(ctx context.Context, id int64) (Type, error)
	LoadVariable(ctx context.Context, id int64) (Variable, error)
	UpdateCategory(ctx context.Context, arg UpdateCategoryParams) error
	UpdateCodebase(ctx context.Context, arg UpdateCodebaseParams) error
	UpdateCodebaseByProjectIdAndVersionTag(ctx context.Context, arg UpdateCodebaseByProjectIdAndVersionTagParams) error
	UpdateFile(ctx context.Context, arg UpdateFileParams) error
	UpdateImport(ctx context.Context, arg UpdateImportParams) error
	UpdateMethod(ctx context.Context, arg UpdateMethodParams) error
	UpdateModule(ctx context.Context, arg UpdateModuleParams) error
	UpdateModuleVersion(ctx context.Context, arg UpdateModuleVersionParams) error
	UpdatePackage(ctx context.Context, arg UpdatePackageParams) error
	UpdatePackageType(ctx context.Context, arg UpdatePackageTypeParams) error
	UpdatePackageVersion(ctx context.Context, arg UpdatePackageVersionParams) error
	UpdateProject(ctx context.Context, arg UpdateProjectParams) error
	UpdateProjectByName(ctx context.Context, arg UpdateProjectByNameParams) error
	UpdateSurveyModule(ctx context.Context, arg UpdateSurveyModuleParams) error
	UpdateSymbolType(ctx context.Context, arg UpdateSymbolTypeParams) error
	UpdateType(ctx context.Context, arg UpdateTypeParams) error
	UpdateVariable(ctx context.Context, arg UpdateVariableParams) error
	UpsertCategory(ctx context.Context, arg UpsertCategoryParams) (Category, error)
	UpsertCodebase(ctx context.Context, arg UpsertCodebaseParams) (Codebase, error)
	UpsertFile(ctx context.Context, arg UpsertFileParams) (File, error)
	UpsertImport(ctx context.Context, arg UpsertImportParams) (Import, error)
	UpsertModule(ctx context.Context, name string) (Module, error)
	UpsertModuleVersion(ctx context.Context, arg UpsertModuleVersionParams) (ModuleVersion, error)
	UpsertPackage(ctx context.Context, arg UpsertPackageParams) (Package, error)
	UpsertPackageType(ctx context.Context, arg UpsertPackageTypeParams) (PackageType, error)
	UpsertPackageVersion(ctx context.Context, arg UpsertPackageVersionParams) (PackageVersion, error)
	UpsertProject(ctx context.Context, arg UpsertProjectParams) (Project, error)
	UpsertSurveyModule(ctx context.Context, arg UpsertSurveyModuleParams) (SurveyModule, error)
	UpsertSymbolType(ctx context.Context, arg UpsertSymbolTypeParams) (SymbolType, error)
}

DataStoreQueries ...

type DeleteCodebaseByProjectIdAndVersionTagParams

type DeleteCodebaseByProjectIdAndVersionTagParams struct {
	ProjectID  int64
	VersionTag string
}

type EnumType

type EnumType interface {
	ID() int
	Name() string
}

type Fields

type Fields []string

func NewFieldsFromString

func NewFieldsFromString(flds string) Fields

func (Fields) DoUpdateSet

func (fs Fields) DoUpdateSet() (s string)

func (Fields) Names

func (fs Fields) Names() (s string)

func (Fields) PlaceHolders

func (fs Fields) PlaceHolders() (s string)

type File

type File struct {
	ID       int64
	SurveyID int64
	Filepath string
}

type FuncDecl

type FuncDecl struct {
	FuncDecl collector.FuncDecl
}

func (FuncDecl) SQL

func (f FuncDecl) SQL() []string

type Import

type Import struct {
	ID        int64
	FileID    int64
	SurveyID  int64
	PackageID int64
	Alias     string
}

type ImportSpec

type ImportSpec struct {
	ImportSpec collector.ImportSpec
}

func (ImportSpec) SQL

func (i ImportSpec) SQL() []string

type InsertCategoryParams

type InsertCategoryParams struct {
	SurveyID int64
	Name     string
}

type InsertCodebaseParams

type InsertCodebaseParams struct {
	ProjectID  int64
	VersionTag string
	SourceUrl  string
}

type InsertFileParams

type InsertFileParams struct {
	SurveyID int64
	Filepath string
}

type InsertImportParams

type InsertImportParams struct {
	FileID    int64
	SurveyID  int64
	PackageID int64
	Alias     string
}

type InsertMethodParams

type InsertMethodParams struct {
	Name     string
	Params   string
	Results  string
	TypeID   int64
	FileID   int64
	SurveyID int64
}

type InsertModuleVersionParams

type InsertModuleVersionParams struct {
	ModuleID int64
	Version  string
}

type InsertPackageParams

type InsertPackageParams struct {
	ImportPath string
	Source     string
	TypeID     int64
}

type InsertPackageTypeParams

type InsertPackageTypeParams struct {
	ID   int64
	Name string
}

type InsertPackageVersionParams

type InsertPackageVersionParams struct {
	PackageID int64
	Version   string
	SourceUrl string
}

type InsertProjectParams

type InsertProjectParams struct {
	Name    string
	About   string
	RepoUrl string
	Website string
}

type InsertSurveyModuleParams

type InsertSurveyModuleParams struct {
	SurveyID        int64
	ModuleID        int64
	ModuleVersionID int64
	PackageID       int64
	FileID          int64
}

type InsertSurveyParams

type InsertSurveyParams struct {
	CodebaseID int64
	LocalDir   string
}

type InsertSymbolTypeParams

type InsertSymbolTypeParams struct {
	ID   int64
	Name string
}

type InsertTypeParams

type InsertTypeParams struct {
	FileID       int64
	SurveyID     int64
	SymbolTypeID int64
	Name         string
	Definition   string
}

type InsertVariableParams

type InsertVariableParams struct {
	Name     string
	TypeID   int64
	SurveyID int64
	Usage    int64
}

type ListSurveysRow

type ListSurveysRow struct {
	ID        int64
	SourceUrl string
	LocalDir  string
	Timestamp string
}

type LoadCodebaseIDByProjectAndVersionParams

type LoadCodebaseIDByProjectAndVersionParams struct {
	Name       string
	VersionTag string
}

type LoadSurveyByRepoURLRow

type LoadSurveyByRepoURLRow struct {
	ID         int64
	CodebaseID int64
	LocalDir   string
	Timestamp  string
	ID_2       int64
	ProjectID  int64
	VersionTag string
	SourceUrl  string
	ID_3       int64
	Name       string
	RepoUrl    string
	About      string
	Website    string
}

type Method

type Method struct {
	ID       int64
	Name     string
	Params   string
	Results  string
	FileID   int64
	SurveyID int64
	TypeID   int64
}

type Module

type Module struct {
	ID   int64
	Name string
}

type ModuleVersion

type ModuleVersion struct {
	ID       int64
	ModuleID int64
	Version  string
}

type ModuleVersionView

type ModuleVersionView struct {
	ID       int64
	ModuleID int64
	Name     string
	Version  string
}

type Package

type Package struct {
	ID         int64
	ImportPath string
	Source     string
	TypeID     int64
	Name       interface{}
}

type PackageType

type PackageType struct {
	ID   int64
	Name string
}

type PackageVersion

type PackageVersion struct {
	ID        int64
	PackageID int64
	Version   string
	SourceUrl string
}

type Project

type Project struct {
	ID      int64
	Name    string
	RepoUrl string
	About   string
	Website string
}

type Queries

type Queries struct {
	// contains filtered or unexported fields
}

func New

func New(db DBTX) *Queries

func (*Queries) DeleteCategory

func (q *Queries) DeleteCategory(ctx context.Context, id int64) error

func (*Queries) DeleteCodebase

func (q *Queries) DeleteCodebase(ctx context.Context, id int64) error

func (*Queries) DeleteCodebaseByProjectIdAndVersionTag

func (q *Queries) DeleteCodebaseByProjectIdAndVersionTag(ctx context.Context, arg DeleteCodebaseByProjectIdAndVersionTagParams) error

func (*Queries) DeleteCodebaseSurveys

func (q *Queries) DeleteCodebaseSurveys(ctx context.Context, codebaseID int64) error

func (*Queries) DeleteFile

func (q *Queries) DeleteFile(ctx context.Context, id int64) error

func (*Queries) DeleteImport

func (q *Queries) DeleteImport(ctx context.Context, id int64) error

func (*Queries) DeleteMethod

func (q *Queries) DeleteMethod(ctx context.Context, id int64) error

func (*Queries) DeleteModule

func (q *Queries) DeleteModule(ctx context.Context, id int64) error

func (*Queries) DeleteModuleVersion

func (q *Queries) DeleteModuleVersion(ctx context.Context, id int64) error

func (*Queries) DeletePackage

func (q *Queries) DeletePackage(ctx context.Context, id int64) error

func (*Queries) DeletePackageType

func (q *Queries) DeletePackageType(ctx context.Context, id int64) error

func (*Queries) DeletePackageVersion

func (q *Queries) DeletePackageVersion(ctx context.Context, id int64) error

func (*Queries) DeleteProject

func (q *Queries) DeleteProject(ctx context.Context, id int64) error

func (*Queries) DeleteProjectByName

func (q *Queries) DeleteProjectByName(ctx context.Context, name string) error

func (*Queries) DeleteSurvey

func (q *Queries) DeleteSurvey(ctx context.Context, id int64) error

func (*Queries) DeleteSurveyModule

func (q *Queries) DeleteSurveyModule(ctx context.Context, id int64) error

func (*Queries) DeleteSymbolType

func (q *Queries) DeleteSymbolType(ctx context.Context, id int64) error

func (*Queries) DeleteType

func (q *Queries) DeleteType(ctx context.Context, id int64) error

func (*Queries) DeleteVariable

func (q *Queries) DeleteVariable(ctx context.Context, id int64) error

func (*Queries) InsertCategory

func (q *Queries) InsertCategory(ctx context.Context, arg InsertCategoryParams) (Category, error)

func (*Queries) InsertCodebase

func (q *Queries) InsertCodebase(ctx context.Context, arg InsertCodebaseParams) (Codebase, error)

func (*Queries) InsertFile

func (q *Queries) InsertFile(ctx context.Context, arg InsertFileParams) (File, error)

func (*Queries) InsertImport

func (q *Queries) InsertImport(ctx context.Context, arg InsertImportParams) (Import, error)

func (*Queries) InsertMethod

func (q *Queries) InsertMethod(ctx context.Context, arg InsertMethodParams) (Method, error)

func (*Queries) InsertModule

func (q *Queries) InsertModule(ctx context.Context, name string) (Module, error)

func (*Queries) InsertModuleVersion

func (q *Queries) InsertModuleVersion(ctx context.Context, arg InsertModuleVersionParams) (ModuleVersion, error)

func (*Queries) InsertPackage

func (q *Queries) InsertPackage(ctx context.Context, arg InsertPackageParams) (Package, error)

func (*Queries) InsertPackageType

func (q *Queries) InsertPackageType(ctx context.Context, arg InsertPackageTypeParams) (PackageType, error)

func (*Queries) InsertPackageVersion

func (q *Queries) InsertPackageVersion(ctx context.Context, arg InsertPackageVersionParams) (PackageVersion, error)

func (*Queries) InsertProject

func (q *Queries) InsertProject(ctx context.Context, arg InsertProjectParams) (Project, error)

func (*Queries) InsertSurvey

func (q *Queries) InsertSurvey(ctx context.Context, arg InsertSurveyParams) (Survey, error)

func (*Queries) InsertSurveyModule

func (q *Queries) InsertSurveyModule(ctx context.Context, arg InsertSurveyModuleParams) (SurveyModule, error)

func (*Queries) InsertSymbolType

func (q *Queries) InsertSymbolType(ctx context.Context, arg InsertSymbolTypeParams) (SymbolType, error)

func (*Queries) InsertType

func (q *Queries) InsertType(ctx context.Context, arg InsertTypeParams) (Type, error)

func (*Queries) InsertVariable

func (q *Queries) InsertVariable(ctx context.Context, arg InsertVariableParams) (Variable, error)

func (*Queries) ListCategories

func (q *Queries) ListCategories(ctx context.Context) ([]Category, error)

func (*Queries) ListCodebaseSurveys

func (q *Queries) ListCodebaseSurveys(ctx context.Context, codebaseID int64) ([]Survey, error)

func (*Queries) ListCodebases

func (q *Queries) ListCodebases(ctx context.Context) ([]Codebase, error)

func (*Queries) ListFiles

func (q *Queries) ListFiles(ctx context.Context) ([]File, error)

func (*Queries) ListFilesBySurvey

func (q *Queries) ListFilesBySurvey(ctx context.Context, surveyID int64) ([]File, error)

func (*Queries) ListImports

func (q *Queries) ListImports(ctx context.Context) ([]Import, error)

func (*Queries) ListMethods

func (q *Queries) ListMethods(ctx context.Context) ([]Method, error)

func (*Queries) ListModuleVersions

func (q *Queries) ListModuleVersions(ctx context.Context) ([]ModuleVersion, error)

func (*Queries) ListModules

func (q *Queries) ListModules(ctx context.Context) ([]Module, error)

func (*Queries) ListPackageTypes

func (q *Queries) ListPackageTypes(ctx context.Context) ([]PackageType, error)

func (*Queries) ListPackageTypesByName

func (q *Queries) ListPackageTypesByName(ctx context.Context) ([]PackageType, error)

func (*Queries) ListPackageVersions

func (q *Queries) ListPackageVersions(ctx context.Context) ([]PackageVersion, error)

func (*Queries) ListPackages

func (q *Queries) ListPackages(ctx context.Context) ([]Package, error)

func (*Queries) ListProjects

func (q *Queries) ListProjects(ctx context.Context) ([]Project, error)

func (*Queries) ListSurveyModules

func (q *Queries) ListSurveyModules(ctx context.Context) ([]SurveyModule, error)

func (*Queries) ListSurveys

func (q *Queries) ListSurveys(ctx context.Context) ([]ListSurveysRow, error)

func (*Queries) ListSymbolTypes

func (q *Queries) ListSymbolTypes(ctx context.Context) ([]SymbolType, error)

func (*Queries) ListSymbolTypesByName

func (q *Queries) ListSymbolTypesByName(ctx context.Context) ([]SymbolType, error)

func (*Queries) ListTypes

func (q *Queries) ListTypes(ctx context.Context) ([]TypeView, error)

func (*Queries) ListTypesByFile

func (q *Queries) ListTypesByFile(ctx context.Context, fileID int64) ([]TypeView, error)

func (*Queries) ListTypesBySurvey

func (q *Queries) ListTypesBySurvey(ctx context.Context, surveyID int64) ([]TypeView, error)

func (*Queries) ListVariables

func (q *Queries) ListVariables(ctx context.Context) ([]Variable, error)

func (*Queries) LoadCategory

func (q *Queries) LoadCategory(ctx context.Context, id int64) (Category, error)

func (*Queries) LoadCodebase

func (q *Queries) LoadCodebase(ctx context.Context, id int64) (Codebase, error)

func (*Queries) LoadCodebaseIDByProjectAndVersion

func (q *Queries) LoadCodebaseIDByProjectAndVersion(ctx context.Context, arg LoadCodebaseIDByProjectAndVersionParams) (int64, error)

func (*Queries) LoadCodebaseIdByRepoURL

func (q *Queries) LoadCodebaseIdByRepoURL(ctx context.Context, repoUrl string) (int64, error)

func (*Queries) LoadFile

func (q *Queries) LoadFile(ctx context.Context, id int64) (File, error)

func (*Queries) LoadImport

func (q *Queries) LoadImport(ctx context.Context, id int64) (Import, error)

func (*Queries) LoadMethod

func (q *Queries) LoadMethod(ctx context.Context, id int64) (Method, error)

func (*Queries) LoadModule

func (q *Queries) LoadModule(ctx context.Context, id int64) (Module, error)

func (*Queries) LoadModuleVersion

func (q *Queries) LoadModuleVersion(ctx context.Context, id int64) (ModuleVersion, error)

func (*Queries) LoadPackage

func (q *Queries) LoadPackage(ctx context.Context, id int64) (Package, error)

func (*Queries) LoadPackageType

func (q *Queries) LoadPackageType(ctx context.Context, id int64) (PackageType, error)

func (*Queries) LoadPackageVersion

func (q *Queries) LoadPackageVersion(ctx context.Context, id int64) (PackageVersion, error)

func (*Queries) LoadProject

func (q *Queries) LoadProject(ctx context.Context, id int64) (Project, error)

func (*Queries) LoadProjectByName

func (q *Queries) LoadProjectByName(ctx context.Context, name string) (Project, error)

func (*Queries) LoadProjectByRepoURL

func (q *Queries) LoadProjectByRepoURL(ctx context.Context, repoUrl string) (Project, error)

func (*Queries) LoadProjectRepoURL

func (q *Queries) LoadProjectRepoURL(ctx context.Context, id int64) (string, error)

func (*Queries) LoadSurvey

func (q *Queries) LoadSurvey(ctx context.Context, id int64) (Survey, error)

func (*Queries) LoadSurveyByRepoURL

func (q *Queries) LoadSurveyByRepoURL(ctx context.Context, repoUrl string) (LoadSurveyByRepoURLRow, error)

func (*Queries) LoadSurveyModule

func (q *Queries) LoadSurveyModule(ctx context.Context, id int64) (SurveyModule, error)

func (*Queries) LoadSymbolType

func (q *Queries) LoadSymbolType(ctx context.Context, id int64) (SymbolType, error)

func (*Queries) LoadType

func (q *Queries) LoadType(ctx context.Context, id int64) (Type, error)

func (*Queries) LoadVariable

func (q *Queries) LoadVariable(ctx context.Context, id int64) (Variable, error)

func (*Queries) UpdateCategory

func (q *Queries) UpdateCategory(ctx context.Context, arg UpdateCategoryParams) error

func (*Queries) UpdateCodebase

func (q *Queries) UpdateCodebase(ctx context.Context, arg UpdateCodebaseParams) error

func (*Queries) UpdateCodebaseByProjectIdAndVersionTag

func (q *Queries) UpdateCodebaseByProjectIdAndVersionTag(ctx context.Context, arg UpdateCodebaseByProjectIdAndVersionTagParams) error

func (*Queries) UpdateFile

func (q *Queries) UpdateFile(ctx context.Context, arg UpdateFileParams) error

func (*Queries) UpdateImport

func (q *Queries) UpdateImport(ctx context.Context, arg UpdateImportParams) error

func (*Queries) UpdateMethod

func (q *Queries) UpdateMethod(ctx context.Context, arg UpdateMethodParams) error

func (*Queries) UpdateModule

func (q *Queries) UpdateModule(ctx context.Context, arg UpdateModuleParams) error

func (*Queries) UpdateModuleVersion

func (q *Queries) UpdateModuleVersion(ctx context.Context, arg UpdateModuleVersionParams) error

func (*Queries) UpdatePackage

func (q *Queries) UpdatePackage(ctx context.Context, arg UpdatePackageParams) error

func (*Queries) UpdatePackageType

func (q *Queries) UpdatePackageType(ctx context.Context, arg UpdatePackageTypeParams) error

func (*Queries) UpdatePackageVersion

func (q *Queries) UpdatePackageVersion(ctx context.Context, arg UpdatePackageVersionParams) error

func (*Queries) UpdateProject

func (q *Queries) UpdateProject(ctx context.Context, arg UpdateProjectParams) error

func (*Queries) UpdateProjectByName

func (q *Queries) UpdateProjectByName(ctx context.Context, arg UpdateProjectByNameParams) error

func (*Queries) UpdateSurveyModule

func (q *Queries) UpdateSurveyModule(ctx context.Context, arg UpdateSurveyModuleParams) error

func (*Queries) UpdateSymbolType

func (q *Queries) UpdateSymbolType(ctx context.Context, arg UpdateSymbolTypeParams) error

func (*Queries) UpdateType

func (q *Queries) UpdateType(ctx context.Context, arg UpdateTypeParams) error

func (*Queries) UpdateVariable

func (q *Queries) UpdateVariable(ctx context.Context, arg UpdateVariableParams) error

func (*Queries) UpsertCategory

func (q *Queries) UpsertCategory(ctx context.Context, arg UpsertCategoryParams) (Category, error)

func (*Queries) UpsertCodebase

func (q *Queries) UpsertCodebase(ctx context.Context, arg UpsertCodebaseParams) (Codebase, error)

func (*Queries) UpsertFile

func (q *Queries) UpsertFile(ctx context.Context, arg UpsertFileParams) (File, error)

func (*Queries) UpsertImport

func (q *Queries) UpsertImport(ctx context.Context, arg UpsertImportParams) (Import, error)

func (*Queries) UpsertModule

func (q *Queries) UpsertModule(ctx context.Context, name string) (Module, error)

func (*Queries) UpsertModuleVersion

func (q *Queries) UpsertModuleVersion(ctx context.Context, arg UpsertModuleVersionParams) (ModuleVersion, error)

func (*Queries) UpsertPackage

func (q *Queries) UpsertPackage(ctx context.Context, arg UpsertPackageParams) (Package, error)

func (*Queries) UpsertPackageType

func (q *Queries) UpsertPackageType(ctx context.Context, arg UpsertPackageTypeParams) (PackageType, error)

func (*Queries) UpsertPackageVersion

func (q *Queries) UpsertPackageVersion(ctx context.Context, arg UpsertPackageVersionParams) (PackageVersion, error)

func (*Queries) UpsertProject

func (q *Queries) UpsertProject(ctx context.Context, arg UpsertProjectParams) (Project, error)

func (*Queries) UpsertSurveyModule

func (q *Queries) UpsertSurveyModule(ctx context.Context, arg UpsertSurveyModuleParams) (SurveyModule, error)

func (*Queries) UpsertSymbolType

func (q *Queries) UpsertSymbolType(ctx context.Context, arg UpsertSymbolTypeParams) (SymbolType, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type RepoInfo

type RepoInfo struct {
	Description string `json:"description"`
	Homepage    string `json:"homepage"`
}

RepoInfo contains relevant information about a GitHub repository

func RequestGitHubRepoInfo

func RequestGitHubRepoInfo(repoURL string) (info *RepoInfo, err error)

RequestGitHubRepoInfo retrieves RepoInfo{} from the GitHub API from a passed GitHub repo URL, returning errors if they exist. gofi:stub

type SQLGenerator

type SQLGenerator interface {
	SQL() []string
}

type SqliteDataStore

type SqliteDataStore struct {
	Filepath string
	// contains filtered or unexported fields
}

func (*SqliteDataStore) DB

func (db *SqliteDataStore) DB() *sql.DB

func (*SqliteDataStore) Initialize

func (ds *SqliteDataStore) Initialize(ctx context.Context) (err error)

func (*SqliteDataStore) Open

func (db *SqliteDataStore) Open() (err error)

func (*SqliteDataStore) Queries

func (db *SqliteDataStore) Queries() DataStoreQueries

func (*SqliteDataStore) Query

func (db *SqliteDataStore) Query(ctx context.Context, sql string) (err error)

func (*SqliteDataStore) SetQueries

func (db *SqliteDataStore) SetQueries(q DataStoreQueries)

type Survey

type Survey struct {
	ID         int64
	CodebaseID int64
	LocalDir   string
	Timestamp  string
}

type SurveyModule

type SurveyModule struct {
	ID              int64
	SurveyID        int64
	ModuleID        int64
	ModuleVersionID int64
	PackageID       int64
	FileID          int64
}

type SurveyPersister

type SurveyPersister struct {
	// contains filtered or unexported fields
}

func NewSurveyPersister

func NewSurveyPersister(survey survey, ds DataStore) *SurveyPersister

func (*SurveyPersister) Persist

func (sp *SurveyPersister) Persist(ctx context.Context, fs scanner.Files) (err error)

func (*SurveyPersister) PersistChan

func (sp *SurveyPersister) PersistChan(ctx context.Context, facetChan chan collector.CodeFacet) (err error)

type SurveyView

type SurveyView struct {
	ID         int64
	Project    string
	CodebaseID int64
	ProjectID  int64
	RepoUrl    string
	VersionTag string
	SourceUrl  string
	LocalDir   string
	Timestamp  string
}

type SymbolType

type SymbolType struct {
	ID   int64
	Name string
}

type TestDB

type TestDB struct {
}

func (TestDB) ExecContext

func (db TestDB) ExecContext(context.Context, string, ...interface{}) (sql.Result, error)

func (TestDB) PrepareContext

func (db TestDB) PrepareContext(context.Context, string) (*sql.Stmt, error)

func (TestDB) QueryContext

func (db TestDB) QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)

func (TestDB) QueryRowContext

func (db TestDB) QueryRowContext(context.Context, string, ...interface{}) *sql.Row

type Type

type Type struct {
	ID           int64
	FileID       int64
	SurveyID     int64
	SymbolTypeID int64
	Name         string
	Definition   string
}

type TypeSpec

type TypeSpec struct {
	TypeSpec collector.TypeSpec
}

func (TypeSpec) SQL

func (t TypeSpec) SQL() []string

type TypeView

type TypeView struct {
	ID           int64
	Project      string
	Filepath     string
	Name         string
	SymbolName   string
	SurveyID     int64
	FileID       int64
	SymbolTypeID int64
	CodebaseID   int64
	Definition   string
	Timestamp    string
	SourceUrl    string
	RepoUrl      string
	AboutProject string
	LocalDir     string
}

type UpdateCategoryParams

type UpdateCategoryParams struct {
	Name string
	ID   int64
}

type UpdateCodebaseByProjectIdAndVersionTagParams

type UpdateCodebaseByProjectIdAndVersionTagParams struct {
	SourceUrl  string
	ProjectID  int64
	VersionTag string
}

type UpdateCodebaseParams

type UpdateCodebaseParams struct {
	ProjectID  int64
	VersionTag string
	SourceUrl  string
	ID         int64
}

type UpdateFileParams

type UpdateFileParams struct {
	Filepath string
	ID       int64
}

type UpdateImportParams

type UpdateImportParams struct {
	FileID    int64
	SurveyID  int64
	PackageID int64
	ID        int64
}

type UpdateMethodParams

type UpdateMethodParams struct {
	Name     string
	Params   string
	Results  string
	TypeID   int64
	FileID   int64
	SurveyID int64
	ID       int64
}

type UpdateModuleParams

type UpdateModuleParams struct {
	Name string
	ID   int64
}

type UpdateModuleVersionParams

type UpdateModuleVersionParams struct {
	ModuleID int64
	Version  string
	ID       int64
}

type UpdatePackageParams

type UpdatePackageParams struct {
	ImportPath string
	Source     string
	TypeID     int64
	ID         int64
}

type UpdatePackageTypeParams

type UpdatePackageTypeParams struct {
	Name string
	ID   int64
}

type UpdatePackageVersionParams

type UpdatePackageVersionParams struct {
	PackageID int64
	Version   string
	SourceUrl string
	ID        int64
}

type UpdateProjectByNameParams

type UpdateProjectByNameParams struct {
	RepoUrl string
	About   string
	Website string
	Name    string
}

type UpdateProjectParams

type UpdateProjectParams struct {
	Name    string
	About   string
	RepoUrl string
	Website string
	ID      int64
}

type UpdateSurveyModuleParams

type UpdateSurveyModuleParams struct {
	SurveyID        int64
	ModuleID        int64
	ModuleVersionID int64
	FileID          int64
	PackageID       int64
	ID              int64
}

type UpdateSymbolTypeParams

type UpdateSymbolTypeParams struct {
	Name string
	ID   int64
}

type UpdateTypeParams

type UpdateTypeParams struct {
	FileID       int64
	SymbolTypeID int64
	Name         string
	Definition   string
	ID           int64
}

type UpdateVariableParams

type UpdateVariableParams struct {
	Name     string
	SurveyID int64
	TypeID   int64
	Usage    int64
	ID       int64
}

type UpsertCategoryParams

type UpsertCategoryParams struct {
	SurveyID int64
	Name     string
}

type UpsertCodebaseParams

type UpsertCodebaseParams struct {
	ProjectID  int64
	VersionTag string
	SourceUrl  string
}

type UpsertFileParams

type UpsertFileParams struct {
	SurveyID int64
	Filepath string
}

type UpsertImportParams

type UpsertImportParams struct {
	FileID    int64
	SurveyID  int64
	PackageID int64
	Alias     string
}

type UpsertModuleVersionParams

type UpsertModuleVersionParams struct {
	ModuleID int64
	Version  string
}

type UpsertPackageParams

type UpsertPackageParams struct {
	ImportPath string
	Source     string
	TypeID     int64
}

type UpsertPackageTypeParams

type UpsertPackageTypeParams struct {
	ID   int64
	Name string
}

type UpsertPackageVersionParams

type UpsertPackageVersionParams struct {
	PackageID int64
	Version   string
	SourceUrl string
}

type UpsertProjectParams

type UpsertProjectParams struct {
	Name    string
	About   string
	RepoUrl string
	Website string
}

type UpsertSpec

type UpsertSpec struct {
	Table  string
	Fields Fields
	OnConf Fields
	UpdSet Fields
}

func NewUpsertSpec

func NewUpsertSpec(tbl string, flds ...string) *UpsertSpec

func (*UpsertSpec) UpsertSQL

func (us *UpsertSpec) UpsertSQL() string

type UpsertSurveyModuleParams

type UpsertSurveyModuleParams struct {
	SurveyID        int64
	ModuleID        int64
	ModuleVersionID int64
	PackageID       int64
	FileID          int64
}

type UpsertSymbolTypeParams

type UpsertSymbolTypeParams struct {
	ID   int64
	Name string
}

type ValueSpec

type ValueSpec struct {
	ValueSpec collector.ValueSpec
}

func (ValueSpec) SQL

func (v ValueSpec) SQL() []string

type Variable

type Variable struct {
	ID       int64
	Name     string
	SurveyID int64
	TypeID   int64
	Usage    int64
	IsParam  interface{}
	IsResult interface{}
}

Jump to

Keyboard shortcuts

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