Documentation ¶
Index ¶
- type Dependency
- type Module
- type PGOption
- type PostgresClient
- func (p *PostgresClient) GetDependees(ctx context.Context, id, version string, pageToken string, count int) ([]Version, string, error)
- func (p *PostgresClient) GetDependents(ctx context.Context, id, version string, pageToken string, count int) ([]Version, string, error)
- func (p *PostgresClient) QueryModuleVersions(ctx context.Context, module string, pageToken string, count int) (results []Version, nextPageToken string, err error)
- func (p *PostgresClient) QueryModules(ctx context.Context, nameFilter string, pageToken string, count int) ([]Module, string, error)
- func (p *PostgresClient) SaveModule(ctx context.Context, name, description string, versions ...string) (err error)
- func (p *PostgresClient) SaveModuleDependencies(ctx context.Context, mod Version, deps ...Version) (err error)
- type Store
- type Version
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dependency ¶
type Dependency struct { DependentID string `json:"dependent_id" db:"dependent_id"` DependeeID string `json:"dependee_id" db:"dependee_id"` }
A Dependency represents a link between specific versions of 2 Go modules
type Module ¶
type Module struct { ID int32 `json:"id" db:"id"` Name string `json:"name,omitempty" db:"name"` Description sql.NullString `json:"description,omitempty" db:"description"` }
A Module represents a particular Go module known by the system.
type PGOption ¶
type PGOption func(*PostgresClient) error
PGOption defines a configuration option to be used when constructing the database connection.
type PostgresClient ¶
type PostgresClient struct {
// contains filtered or unexported fields
}
PostgresClient performs store-related operations against a postgres backend database.
func NewPostgresClient ¶
NewPostgresClient initializes a store client for interacting with a PostgreSQL backend. If it can not immediately reach the target database, an error is returned.
func (*PostgresClient) GetDependees ¶
func (p *PostgresClient) GetDependees(ctx context.Context, id, version string, pageToken string, count int) ([]Version, string, error)
GetDependees retrieves all known module versions that the given module id and version pair depend on.
func (*PostgresClient) GetDependents ¶
func (p *PostgresClient) GetDependents(ctx context.Context, id, version string, pageToken string, count int) ([]Version, string, error)
GetDependents retrieves all known module versions that depend on the given module id and version pair.
func (*PostgresClient) QueryModuleVersions ¶
func (p *PostgresClient) QueryModuleVersions(ctx context.Context, module string, pageToken string, count int) (results []Version, nextPageToken string, err error)
QueryModuleVersions returns a list of 0 or more module versions for the specified module, along with a paging token.
The pageToken argument, if provided, should be the return value from a prior call to this method with the same filter. It will be decoded to determine the next "page" of results. An invalid page token will result in an error being returned.
func (*PostgresClient) QueryModules ¶
func (p *PostgresClient) QueryModules(ctx context.Context, nameFilter string, pageToken string, count int) ([]Module, string, error)
QueryModules returns a list of 0 to count modules that match the specified name filter (glob format), along with a paging token.
The pageToken argument, if provided, should be the return value from a prior call to this method with the same filter. It will be decoded to determine the next "page" of results. An invalid page token will result in an error being returned.
func (*PostgresClient) SaveModule ¶
func (p *PostgresClient) SaveModule(ctx context.Context, name, description string, versions ...string) (err error)
SaveModule upserts module metadata. If there is an existing module with the provided name the description will be updated. Otherwise, a new module will be inserted.
func (*PostgresClient) SaveModuleDependencies ¶
func (p *PostgresClient) SaveModuleDependencies(ctx context.Context, mod Version, deps ...Version) (err error)
SaveModuleDependencies writes the specified set of direct dependencies of mod to the database.
type Store ¶
type Store interface { SaveModule(ctx context.Context, name, description string, versions ...string) error SaveModuleDependencies(ctx context.Context, mod Version, deps ...Version) error QueryModules(ctx context.Context, nameFilter string, pageToken string, count int) ([]Module, string, error) QueryModuleVersions(ctx context.Context, module string, pageToken string, count int) (results []Version, nextPageToken string, err error) GetDependents(ctx context.Context, id, version string, pageToken string, count int) ([]Version, string, error) GetDependees(ctx context.Context, id, version string, pageToken string, count int) ([]Version, string, error) }
Store defines the operations available on a Perseus data store