Documentation
¶
Index ¶
- func ConnectENV() (*sql.DB, error)
- func ConnectENVWithOrg(orgId int) (*sql.DB, error)
- func ConnectRDS() (*sql.DB, error)
- func ConnectRDSWithOrg(orgId int) (*sql.DB, error)
- func ContributorColumns() []string
- func ReadContributorColumns() string
- func WriteContributorColumns() string
- type ContributorNotFoundError
- type CreateDatasetParams
- type DBTX
- type DatasetNotFoundError
- type DatasetUserNotFoundError
- type NewContributor
- type OrganizationUserNotFoundError
- type Queries
- func (q *Queries) AddContributor(ctx context.Context, newContributor NewContributor) (*pgdb.Contributor, error)
- func (q *Queries) AddDatasetContributor(ctx context.Context, dataset *pgdb.Dataset, contributor *pgdb.Contributor) (*pgdb.DatasetContributor, error)
- func (q *Queries) AddDatasetUser(ctx context.Context, dataset *pgdb.Dataset, user *pgdb.User, role role.Role) (*pgdb.DatasetUser, error)
- func (q *Queries) AddFiles(ctx context.Context, files []pgdb.FileParams) ([]pgdb.File, error)
- func (q *Queries) AddFolder(ctx context.Context, r pgdb.PackageParams) (*pgdb.Package, error)
- func (q *Queries) AddOrganizationUser(ctx context.Context, orgId int64, userId int64, permBit pgdb.DbPermission) (*pgdb.OrganizationUser, error)
- func (q *Queries) AddPackages(ctx context.Context, records []pgdb.PackageParams) ([]pgdb.Package, error)
- func (q *Queries) CreateDataset(ctx context.Context, p CreateDatasetParams) (*pgdb.Dataset, error)
- func (q *Queries) FindContributor(ctx context.Context, search NewContributor) (*pgdb.Contributor, error)
- func (q *Queries) GetByCognitoId(ctx context.Context, id string) (*pgdb.User, error)
- func (q *Queries) GetContributor(ctx context.Context, id int64) (*pgdb.Contributor, error)
- func (q *Queries) GetContributorByEmail(ctx context.Context, email string) (*pgdb.Contributor, error)
- func (q *Queries) GetContributorByOrcid(ctx context.Context, orcid string) (*pgdb.Contributor, error)
- func (q *Queries) GetContributorByUserId(ctx context.Context, userId int64) (*pgdb.Contributor, error)
- func (q *Queries) GetDatasetByName(ctx context.Context, name string) (*pgdb.Dataset, error)
- func (q *Queries) GetDatasetClaim(ctx context.Context, user *pgdb.User, datasetNodeId string, ...) (*dataset.Claim, error)
- func (q *Queries) GetDatasetContributor(ctx context.Context, datasetId int64, contributorId int64) (*pgdb.DatasetContributor, error)
- func (q *Queries) GetDatasetStorageById(ctx context.Context, datasetId int64) (int64, error)
- func (q *Queries) GetDatasetUser(ctx context.Context, dataset *pgdb.Dataset, user *pgdb.User) (*pgdb.DatasetUser, error)
- func (q *Queries) GetDatasets(ctx context.Context, organizationId int) ([]pgdb.Dataset, error)
- func (q *Queries) GetDefaultDataUseAgreement(ctx context.Context, organizationId int) (*pgdb.DataUseAgreement, error)
- func (q *Queries) GetDefaultDatasetStatus(ctx context.Context, organizationId int) (*pgdb.DatasetStatus, error)
- func (q *Queries) GetFeatureFlags(ctx context.Context, organizationId int64) ([]pgdb.FeatureFlags, error)
- func (q *Queries) GetOrganization(ctx context.Context, id int64) (*pgdb.Organization, error)
- func (q *Queries) GetOrganizationClaim(ctx context.Context, userId int64, organizationId int64) (*organization.Claim, error)
- func (q *Queries) GetOrganizationStorageById(ctx context.Context, organizationId int64) (int64, error)
- func (q *Queries) GetOrganizationUser(ctx context.Context, orgId int64, userId int64) (*pgdb.OrganizationUser, error)
- func (q *Queries) GetOrganizationUserById(ctx context.Context, id int64) (*pgdb.OrganizationUser, error)
- func (q *Queries) GetPackageByNodeId(ctx context.Context, nodeId string) (*pgdb.Package, error)
- func (q *Queries) GetPackageChildren(ctx context.Context, parent *pgdb.Package, datasetId int, onlyFolders bool) ([]pgdb.Package, error)
- func (q *Queries) GetPackageStorageById(ctx context.Context, packageId int64) (int64, error)
- func (q *Queries) GetTokenByCognitoId(ctx context.Context, id string) (*pgdb.Token, error)
- func (q *Queries) GetUserByCognitoId(ctx context.Context, id string) (*pgdb.User, error)
- func (q *Queries) GetUserById(ctx context.Context, id int64) (*pgdb.User, error)
- func (q *Queries) IncrementDatasetStorage(ctx context.Context, datasetId int64, size int64) error
- func (q *Queries) IncrementOrganizationStorage(ctx context.Context, organizationId int64, size int64) error
- func (q *Queries) IncrementPackageStorage(ctx context.Context, packageId int64, size int64) error
- func (q *Queries) IncrementPackageStorageAncestors(ctx context.Context, parentId int64, size int64) error
- func (q *Queries) ShowSearchPath(loc string)
- func (q *Queries) UpdateBucketForFile(ctx context.Context, uploadId string, bucket string, s3Key string, ...) error
- func (q *Queries) WithOrg(orgId int) (*Queries, error)
- func (q *Queries) WithTx(tx *sql.Tx) *Queries
- type SQLStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConnectENV ¶
ConnectENV returns a DB instance. Used for testing, it requires the following environment variables to be set - POSTGRES_HOST - POSTGRES_PORT (will default to 5432 if missing) - POSTGRES_USER - POSTGRES_PASSWORD - PENNSIEVE_DB - POSTGRES_SSL_MODE (should be set to "disable" if the server is not https, left blank if it is)
func ConnectRDS ¶
ConnectRDS returns a DB instance. The Lambda function leverages IAM roles to gain access to the DB Proxy. The function does NOT set the search_path to the organization schema. Requires following LAMBDA ENV VARIABLES:
- RDS_PROXY_ENDPOINT
- REGION
- ENV
func ConnectRDSWithOrg ¶
ConnectRDSWithOrg returns a DB instance. The Lambda function leverages IAM roles to gain access to the DB Proxy. The function DOES set the search_path to the organization schema.
func ContributorColumns ¶ added in v1.4.0
func ContributorColumns() []string
func ReadContributorColumns ¶ added in v1.4.0
func ReadContributorColumns() string
func WriteContributorColumns ¶ added in v1.4.0
func WriteContributorColumns() string
Types ¶
type ContributorNotFoundError ¶ added in v1.4.0
type ContributorNotFoundError struct {
// contains filtered or unexported fields
}
func (ContributorNotFoundError) Error ¶ added in v1.4.0
func (e ContributorNotFoundError) Error() string
type CreateDatasetParams ¶ added in v1.4.0
type CreateDatasetParams struct { Name string Description string Status *pgdb.DatasetStatus AutomaticallyProcessPackages bool License string Tags []string DataUseAgreement *pgdb.DataUseAgreement }
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 }
DBTX Default interface with methods that are available for both DB adn TX sessions.
type DatasetNotFoundError ¶ added in v1.4.0
type DatasetNotFoundError struct {
ErrorMessage string
}
func (DatasetNotFoundError) Error ¶ added in v1.4.0
func (e DatasetNotFoundError) Error() string
type DatasetUserNotFoundError ¶ added in v1.4.0
type DatasetUserNotFoundError struct {
ErrorMessage string
}
func (DatasetUserNotFoundError) Error ¶ added in v1.4.0
func (e DatasetUserNotFoundError) Error() string
type NewContributor ¶ added in v1.4.0
type OrganizationUserNotFoundError ¶ added in v1.4.0
type OrganizationUserNotFoundError struct {
ErrorMessage string
}
func (OrganizationUserNotFoundError) Error ¶ added in v1.4.0
func (e OrganizationUserNotFoundError) Error() string
type Queries ¶
type Queries struct {
// contains filtered or unexported fields
}
Queries is a struct with a db object that implements the DBTX interface. This means that db can either be a direct DB connection or a TX transaction.
func (*Queries) AddContributor ¶ added in v1.4.0
func (q *Queries) AddContributor(ctx context.Context, newContributor NewContributor) (*pgdb.Contributor, error)
AddContributor will add a Contributor to the Organization's Contributors table.
func (*Queries) AddDatasetContributor ¶ added in v1.4.0
func (q *Queries) AddDatasetContributor(ctx context.Context, dataset *pgdb.Dataset, contributor *pgdb.Contributor) (*pgdb.DatasetContributor, error)
func (*Queries) AddDatasetUser ¶ added in v1.4.0
func (*Queries) AddOrganizationUser ¶ added in v1.4.0
func (q *Queries) AddOrganizationUser(ctx context.Context, orgId int64, userId int64, permBit pgdb.DbPermission) (*pgdb.OrganizationUser, error)
func (*Queries) AddPackages ¶
func (q *Queries) AddPackages(ctx context.Context, records []pgdb.PackageParams) ([]pgdb.Package, error)
AddPackages adds packages to a dataset.
- This call should typically be wrapped in a Transaction as it will run multiple queries.
- Packages can be in different folders, but it is assumed that the folders already exist.
func (*Queries) CreateDataset ¶ added in v1.4.0
func (*Queries) FindContributor ¶ added in v1.4.1
func (q *Queries) FindContributor(ctx context.Context, search NewContributor) (*pgdb.Contributor, error)
FindContributor will search for a contributor by several User Id, Email Address, and ORCID
func (*Queries) GetByCognitoId ¶
GetByCognitoId returns a user from Postgress based on his/her cognito-id This function also returns the preferred org and whether the user is a super-admin.
func (*Queries) GetContributor ¶ added in v1.4.0
GetContributor will get a Contributor by the Contributor Id (not the User Id).
func (*Queries) GetContributorByEmail ¶ added in v1.4.0
func (q *Queries) GetContributorByEmail(ctx context.Context, email string) (*pgdb.Contributor, error)
GetContributorByEmail will get a Contributor by Email Address.
func (*Queries) GetContributorByOrcid ¶ added in v1.4.0
func (q *Queries) GetContributorByOrcid(ctx context.Context, orcid string) (*pgdb.Contributor, error)
GetContributorByOrcid will get a Contributor by ORCID iD.
func (*Queries) GetContributorByUserId ¶ added in v1.4.0
func (q *Queries) GetContributorByUserId(ctx context.Context, userId int64) (*pgdb.Contributor, error)
GetContributorByUserId will get a Contributor by User Id.
func (*Queries) GetDatasetByName ¶ added in v1.4.0
GetDatasetByName will query workspace datasets by name and return one if found.
func (*Queries) GetDatasetClaim ¶
func (q *Queries) GetDatasetClaim(ctx context.Context, user *pgdb.User, datasetNodeId string, organizationId int64) (*dataset.Claim, error)
GetDatasetClaim returns the highest role that the user has for a given dataset. This method checks the roles of the dataset, the teams, and the specific user roles.
func (*Queries) GetDatasetContributor ¶ added in v1.4.0
func (*Queries) GetDatasetStorageById ¶
func (*Queries) GetDatasetUser ¶ added in v1.4.0
func (*Queries) GetDatasets ¶
GetDatasets returns all rows in the Upload Record Table
func (*Queries) GetDefaultDataUseAgreement ¶ added in v1.4.0
func (q *Queries) GetDefaultDataUseAgreement(ctx context.Context, organizationId int) (*pgdb.DataUseAgreement, error)
GetDefaultDataUseAgreement will return the default data use agreement for the organization.
func (*Queries) GetDefaultDatasetStatus ¶ added in v1.4.0
func (q *Queries) GetDefaultDatasetStatus(ctx context.Context, organizationId int) (*pgdb.DatasetStatus, error)
GetDefaultDatasetStatus will return the default dataset status for the organization. This is assumed to be the dataset status row with the lowest id number.
func (*Queries) GetFeatureFlags ¶
func (q *Queries) GetFeatureFlags(ctx context.Context, organizationId int64) ([]pgdb.FeatureFlags, error)
GetFeatureFlags returns all rows in the FeatureFlags Table
func (*Queries) GetOrganization ¶
GetOrganization returns a single organization
func (*Queries) GetOrganizationClaim ¶
func (q *Queries) GetOrganizationClaim(ctx context.Context, userId int64, organizationId int64) (*organization.Claim, error)
GetOrganizationClaim returns an organization claim for a specific user.
func (*Queries) GetOrganizationStorageById ¶
func (*Queries) GetOrganizationUser ¶ added in v1.4.0
func (*Queries) GetOrganizationUserById ¶
func (*Queries) GetPackageByNodeId ¶
func (*Queries) GetPackageChildren ¶
func (q *Queries) GetPackageChildren(ctx context.Context, parent *pgdb.Package, datasetId int, onlyFolders bool) ([]pgdb.Package, error)
GetPackageChildren Get the children in a package
func (*Queries) GetPackageStorageById ¶
func (*Queries) GetTokenByCognitoId ¶
GetTokenByCognitoId returns a user from Postgress based on his/her cognito-id This function also returns the preferred org and whether the user is a super-admin.
func (*Queries) GetUserByCognitoId ¶
GetUserByCognitoId returns a Pennsieve User based on the cognito id in the token pool.
func (*Queries) GetUserById ¶ added in v1.4.0
GetUserById returns a user from Postgres based on the user's int id This function also returns the preferred org and whether the user is a super-admin.
func (*Queries) IncrementDatasetStorage ¶
IncrementDatasetStorage increases the storage associated with the provided dataset.
func (*Queries) IncrementOrganizationStorage ¶
func (q *Queries) IncrementOrganizationStorage(ctx context.Context, organizationId int64, size int64) error
IncrementOrganizationStorage increases the storage associated with the provided organization.
func (*Queries) IncrementPackageStorage ¶
IncrementPackageStorage increases the storage associated with the provided package.
func (*Queries) IncrementPackageStorageAncestors ¶
func (q *Queries) IncrementPackageStorageAncestors(ctx context.Context, parentId int64, size int64) error
IncrementPackageStorageAncestors increases the storage associated with the parents of the provided package.