storage

package
v0.0.0-...-49ee2ef Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyzedAuditGetByModelPlanIDsAndDate

func AnalyzedAuditGetByModelPlanIDsAndDate(
	np sqlutils.NamedPreparer,
	_ *zap.Logger,
	modelPlanIDs []uuid.UUID,
	date time.Time,
) ([]*models.AnalyzedAudit, error)

AnalyzedAuditGetByModelPlanIDsAndDate gets and returns all AnalyzedAudits by modelPlanIDs and date

func AnalyzedAuditGetByModelPlanIDsAndDateLoader

func AnalyzedAuditGetByModelPlanIDsAndDateLoader(
	np sqlutils.NamedPreparer,
	paramTableJSON string,
) ([]*models.AnalyzedAudit, error)

AnalyzedAuditGetByModelPlanIDsAndDateLoader gets and returns all AnalyzedAudits by modelPlanIDs and date using a dataLoader

func DiscussionReplyCreate

func DiscussionReplyCreate(
	logger *zap.Logger,
	reply *models.DiscussionReply,
	np sqlutils.NamedPreparer,
) (*models.DiscussionReply, error)

DiscussionReplyCreate creates a discussion reply the method is expected to be part of a larger transaction and does not handle committing or rolling back the transactions if the *sqlx.Tx is nil, this function will create one. The returned tx is the same as the one in the parameters.

func PlanCollaboratorGetIDLOADER

func PlanCollaboratorGetIDLOADER(
	np sqlutils.NamedPreparer,
	paramTableJSON string,
) ([]*models.PlanCollaborator, error)

PlanCollaboratorGetIDLOADER returns the plan collaborators corresponding to an array of plan collaborator IDs stored in JSON array

func PlanFavoriteGetCollectionByUserID

func PlanFavoriteGetCollectionByUserID(
	np sqlutils.NamedPreparer,
	_ *zap.Logger,
	userAccountID uuid.UUID,
) ([]*models.PlanFavorite, error)

PlanFavoriteGetCollectionByUserID returns plan favorites by userID

func TagCollectionCreate

func TagCollectionCreate(np sqlutils.NamedPreparer, _ *zap.Logger, tags []*models.Tag, createdBy uuid.UUID) ([]*models.Tag, error)

TagCollectionCreate creates an array of tags in the database based on the tag context provided in the string the method is expected to be part of a larger transaction and does not handle committing or rolling back the transactions

func UserAccountGetByID

func UserAccountGetByID(np sqlutils.NamedPreparer, id uuid.UUID) (*authentication.UserAccount, error)

UserAccountGetByID gets a User account from the database by its internal id.

func UserAccountGetByUsername

func UserAccountGetByUsername(np sqlutils.NamedPreparer, username string) (*authentication.UserAccount, error)

UserAccountGetByUsername gets a user account by a give username

func UserAccountInsertByUsername

func UserAccountInsertByUsername(np sqlutils.NamedPreparer, userAccount *authentication.UserAccount) (*authentication.UserAccount, error)

UserAccountInsertByUsername creates a new user account for a given username

func UserAccountUpdateByUserName

func UserAccountUpdateByUserName(np sqlutils.NamedPreparer, userAccount *authentication.UserAccount) (
	*authentication.UserAccount,
	error,
)

UserAccountUpdateByUserName updates an existing user account for a given username

func UserNotificationPreferencesCreate

func UserNotificationPreferencesCreate(np sqlutils.NamedPreparer, userNotificationPreferences *models.UserNotificationPreferences) (*models.UserNotificationPreferences, error)

UserNotificationPreferencesCreate creates a new UserNotificationPreferences in the database

func UserNotificationPreferencesGetByUserID

func UserNotificationPreferencesGetByUserID(np sqlutils.NamedPreparer, userID uuid.UUID) (*models.UserNotificationPreferences, error)

UserNotificationPreferencesGetByUserID returns a UserNotificationPreferences object for a given user_id in the database Note this should only be used for cases when a data loader is not possible to use directly.

func UserNotificationPreferencesGetByUserIDLoader

func UserNotificationPreferencesGetByUserIDLoader(np sqlutils.NamedPreparer, paramTableJSON string) ([]*models.UserNotificationPreferences, error)

UserNotificationPreferencesGetByUserIDLoader returns a collection of UserNotificationPreferences object for a given collection of user_ids, serialized in json

func UserNotificationPreferencesUpdate

func UserNotificationPreferencesUpdate(np sqlutils.NamedPreparer, userNotificationPreferences *models.UserNotificationPreferences) (*models.UserNotificationPreferences, error)

UserNotificationPreferencesUpdate updates a new UserNotificationPreferences in the database

Types

type DBConfig

type DBConfig struct {
	Host           string
	Port           string
	Database       string
	Username       string
	Password       string
	SSLMode        string
	UseIAM         bool
	MaxConnections int
}

DBConfig holds the configurations for a database connection

type Store

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

Store performs database operations for MINT

func NewStore

func NewStore(
	config DBConfig,
	ldClient *ld.LDClient,
) (*Store, error)

NewStore creates a new Store struct The `db` property on the Store will always be a *sqlx.DB, but a notable difference in the DB is that if config.UseIAM is true, that DB instance will be backed by a custom connector in iam_db.go that generates IAM auth tokens when making new connections to the database. If config.UseIAM is false, it will connect using the "postgres" driver that SQLx registers in its init() function https://github.com/jmoiron/sqlx/blob/75a7ebf246fd757c9c7742da7dc4d26c6fdb6b5b/bind.go#L33-L40

func (*Store) AnalyzedAuditCreate

func (s *Store) AnalyzedAuditCreate(
	logger *zap.Logger,
	AnalyzedAudit *models.AnalyzedAudit,
) (*models.AnalyzedAudit, error)

AnalyzedAuditCreate creates and returns an AnalyzedAudit object

func (*Store) AnalyzedAuditGetByDate

func (s *Store) AnalyzedAuditGetByDate(_ *zap.Logger, date time.Time) ([]*models.AnalyzedAudit, error)

AnalyzedAuditGetByDate gets and returns all AnalyzedAudits by date

func (*Store) AnalyzedAuditGetByModelPlanIDAndDate

func (s *Store) AnalyzedAuditGetByModelPlanIDAndDate(
	_ *zap.Logger,
	modelPlanID uuid.UUID,
	date time.Time,
) (*models.AnalyzedAudit, error)

AnalyzedAuditGetByModelPlanIDAndDate gets and returns all AnalyzedAudits by modelPlanID

func (*Store) AuditChangeCollectionByIDAndTable

func (s *Store) AuditChangeCollectionByIDAndTable(
	_ *zap.Logger,
	tableName string,
	primaryKey uuid.UUID,
) ([]*models.AuditChange, error)

AuditChangeCollectionByIDAndTable returns changes based on tablename and primary key from the database

func (*Store) AuditChangeCollectionByIDAndTableAndField

func (s *Store) AuditChangeCollectionByIDAndTableAndField(
	_ *zap.Logger,
	tableName string,
	primaryKey uuid.UUID,
	fieldName string,
	sortDir models.SortDirection,
) ([]*models.AuditChange, error)

AuditChangeCollectionByIDAndTableAndField returns changes based on tablename and primary key from the database. It will only return record sets where the given field was modified. It will return all changed fields anywyas

func (*Store) AuditChangeCollectionByPrimaryKeyOrForeignKeyAndDate

func (s *Store) AuditChangeCollectionByPrimaryKeyOrForeignKeyAndDate(
	_ *zap.Logger,
	primaryKey uuid.UUID,
	foreignKey uuid.UUID,
	dayToAnalyze time.Time,
	sortDir models.SortDirection,
) ([]*models.AuditChange, error)

AuditChangeCollectionByPrimaryKeyOrForeignKeyAndDate returns changes based on foreign key and date from the database.

func (*Store) Beginx

func (s *Store) Beginx() (*sqlx.Tx, error)

Beginx implements the TransactionPreparer interface Implementing the sqlutils.TransactionPreparer interfaces allows us to use a sqlx.DB or a storage.Store to create a transaction

func (*Store) CheckIfCollaborator

func (s *Store) CheckIfCollaborator(_ *zap.Logger, principalID uuid.UUID, modelPlanID uuid.UUID) (bool, error)

CheckIfCollaborator returns true if the principal is a collaborator on a model plan.

func (*Store) CheckIfCollaboratorByDiscussionID

func (s *Store) CheckIfCollaboratorByDiscussionID(
	_ *zap.Logger,
	principalID uuid.UUID,
	discussionID uuid.UUID,
) (bool, error)

CheckIfCollaboratorByDiscussionID returns true if the principal is a collaborator on a model plan, by the relation on the plan discussion

func (*Store) CheckIfCollaboratorByOperationalNeedID

func (s *Store) CheckIfCollaboratorByOperationalNeedID(
	_ *zap.Logger,
	principalID uuid.UUID,
	operationalNeedID uuid.UUID,
) (bool, error)

CheckIfCollaboratorByOperationalNeedID returns true if the principal is a collaborator on a model plan associated with a OperationalNeed by OperationalNeedID.

func (*Store) CheckIfCollaboratorBySolutionID

func (s *Store) CheckIfCollaboratorBySolutionID(
	_ *zap.Logger,
	principalID uuid.UUID,
	solutionID uuid.UUID,
) (bool, error)

CheckIfCollaboratorBySolutionID returns true if the principal is a collaborator on a model plan associated with a Solution by SolutionID.

func (*Store) DiscussionReplyByID

func (s *Store) DiscussionReplyByID(_ *zap.Logger, id uuid.UUID) (*models.DiscussionReply, error)

DiscussionReplyByID retrieves the discussion reply for a given id

func (*Store) DiscussionReplyDelete

func (s *Store) DiscussionReplyDelete(logger *zap.Logger, id uuid.UUID, userID uuid.UUID) (*models.DiscussionReply, error)

DiscussionReplyDelete deletes the discussion reply for a given id

func (*Store) DiscussionReplyGetByDiscussionIDLOADER

func (s *Store) DiscussionReplyGetByDiscussionIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.DiscussionReply, error)

DiscussionReplyGetByDiscussionIDLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) DiscussionReplyUpdate

func (s *Store) DiscussionReplyUpdate(
	logger *zap.Logger,
	reply *models.DiscussionReply,
) (*models.DiscussionReply, error)

DiscussionReplyUpdate updates a discussion reply object

func (*Store) ExistingModelCollectionGet

func (s *Store) ExistingModelCollectionGet(_ *zap.Logger) ([]*models.ExistingModel, error)

ExistingModelCollectionGet returns a list of existing models

func (*Store) ExistingModelGetByIDLOADER

func (s *Store) ExistingModelGetByIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.ExistingModel, error)

ExistingModelGetByIDLOADER returns the existing model for a slice of model plan ids

func (*Store) ExistingModelLinkGetByID

func (s *Store) ExistingModelLinkGetByID(logger *zap.Logger, id uuid.UUID) (*models.ExistingModelLink, error)

ExistingModelLinkGetByID returns an an existing model link by ID

func (*Store) ExistingModelLinkGetByModelPlanIDAndFieldNameLOADER

func (s *Store) ExistingModelLinkGetByModelPlanIDAndFieldNameLOADER(
	logger *zap.Logger,
	paramTableJSON string,
) ([]*models.ExistingModelLink, error)

ExistingModelLinkGetByModelPlanIDAndFieldNameLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) ExistingModelLinksUpdate

func (s *Store) ExistingModelLinksUpdate(
	logger *zap.Logger,
	userID uuid.UUID,
	modelPlanID uuid.UUID,
	fieldName models.ExisitingModelLinkFieldType,
	existingModelIDs []int,
	currentModelPlanIDs []uuid.UUID,
) ([]*models.ExistingModelLink, error)

ExistingModelLinksUpdate creates a new links that don't yet exist, deletes ones that are no longer provided,

func (*Store) GetDiscussionReplyDetailsForEmail

func (s *Store) GetDiscussionReplyDetailsForEmail(discussionID uuid.UUID) ([]*email.DiscussionReplyEmailContentDB, error)

GetDiscussionReplyDetailsForEmail returns Discussion replies along with user account information for each reply. It is sorted by the database with the newest replies going to oldest replies.

func (*Store) GetExistingModelLinkNamesByModelPlanIDAndFieldNameLOADER

func (s *Store) GetExistingModelLinkNamesByModelPlanIDAndFieldNameLOADER(
	logger *zap.Logger,
	paramTableJSON string,
) ([]*models.ExistingModelLinks, error)

GetExistingModelLinkNamesByModelPlanIDAndFieldNameLOADER returns the plan GeneralCharacteristics for a slice of model plan ids and field Names

func (*Store) GetMostRecentDiscussionRoleSelection

func (s *Store) GetMostRecentDiscussionRoleSelection(
	logger *zap.Logger,
	userID uuid.UUID,
) (*models.DiscussionRoleSelection, error)

GetMostRecentDiscussionRoleSelection retrieves the latest role selection for a given user

func (*Store) GetSolutionSelectedDetails

func (s *Store) GetSolutionSelectedDetails(solutionID uuid.UUID) (*email.SolutionSelectedDB, error)

GetSolutionSelectedDetails queries the database to return information that is useful

func (*Store) ModelPlanCollection

func (s *Store) ModelPlanCollection(logger *zap.Logger, archived bool) ([]*models.ModelPlan, error)

ModelPlanCollection returns a list of all model plans (whether or not you're a collaborator)

func (*Store) ModelPlanCollectionCollaboratorOnly

func (s *Store) ModelPlanCollectionCollaboratorOnly(
	logger *zap.Logger,
	archived bool,
	userID uuid.UUID,
) ([]*models.ModelPlan, error)

ModelPlanCollectionCollaboratorOnly returns a list of all model plans for which the user_accountID supplied is a collaborator.

func (*Store) ModelPlanCollectionWithCRTDLS

func (s *Store) ModelPlanCollectionWithCRTDLS(logger *zap.Logger, archived bool) ([]*models.ModelPlan, error)

ModelPlanCollectionWithCRTDLS returns a list of all model plans for which the there are CRTDls

func (*Store) ModelPlanCreate

func (s *Store) ModelPlanCreate(np sqlutils.NamedPreparer, logger *zap.Logger, plan *models.ModelPlan) (*models.ModelPlan, error)

ModelPlanCreate creates a model plan using a transaction

func (*Store) ModelPlanDeleteByID

func (s *Store) ModelPlanDeleteByID(logger *zap.Logger, id uuid.UUID) (sql.Result, error)

ModelPlanDeleteByID deletes a model plan for a given ID

func (*Store) ModelPlanGetByID

func (s *Store) ModelPlanGetByID(np sqlutils.NamedPreparer, logger *zap.Logger, id uuid.UUID) (*models.ModelPlan, error)

ModelPlanGetByID returns a model plan for a given ID

func (*Store) ModelPlanGetByModelPlanIDLOADER

func (s *Store) ModelPlanGetByModelPlanIDLOADER(_ *zap.Logger, paramTableJSON string) ([]*models.ModelPlan, error)

ModelPlanGetByModelPlanIDLOADER returns the model plan for a slice of ids

func (*Store) ModelPlanGetByName

func (s *Store) ModelPlanGetByName(logger *zap.Logger, modelName string) (*models.ModelPlan, error)

ModelPlanGetByName returns a model plan for a given ID

func (*Store) ModelPlanUpdate

func (s *Store) ModelPlanUpdate(logger *zap.Logger, plan *models.ModelPlan) (*models.ModelPlan, error)

ModelPlanUpdate updates a model plan

func (*Store) NDAAgreementCreate

func (s *Store) NDAAgreementCreate(_ *zap.Logger, nda *models.NDAAgreement) (*models.NDAAgreement, error)

NDAAgreementCreate creates a new nda agreement based on an EUA

func (*Store) NDAAgreementGetByUserID

func (s *Store) NDAAgreementGetByUserID(_ *zap.Logger, userID uuid.UUID) (*models.NDAAgreement, error)

NDAAgreementGetByUserID returns an NDA based on a UserID

func (*Store) NDAAgreementUpdate

func (s *Store) NDAAgreementUpdate(_ *zap.Logger, nda *models.NDAAgreement) (*models.NDAAgreement, error)

NDAAgreementUpdate updates an nda agreement based on userID

func (*Store) OperationalNeedCollectionGetByModelPlanID

func (s *Store) OperationalNeedCollectionGetByModelPlanID(
	_ *zap.Logger,
	modelPlanID uuid.UUID,
) ([]*models.OperationalNeed, error)

OperationalNeedCollectionGetByModelPlanID returns possible and existing OperationalNeeds associated to a model plan

func (*Store) OperationalNeedCollectionGetByModelPlanIDLOADER

func (s *Store) OperationalNeedCollectionGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.OperationalNeed, error)

OperationalNeedCollectionGetByModelPlanIDLOADER returns OperationalNeeds utilizing a Data Loader

func (*Store) OperationalNeedGetByID

func (s *Store) OperationalNeedGetByID(_ *zap.Logger, id uuid.UUID) (*models.OperationalNeed, error)

OperationalNeedGetByID returns an Operational Need by its ID

func (*Store) OperationalNeedGetByModelPlanIDAndOtherType

func (s *Store) OperationalNeedGetByModelPlanIDAndOtherType(
	_ *zap.Logger,
	modelPlanID uuid.UUID,
	customNeedType string,
) (*models.OperationalNeed, error)

OperationalNeedGetByModelPlanIDAndOtherType existing OperationalNeed associated to a model plan by id and custom type

func (*Store) OperationalNeedGetByModelPlanIDAndType

func (s *Store) OperationalNeedGetByModelPlanIDAndType(
	_ *zap.Logger,
	modelPlanID uuid.UUID,
	needKey models.OperationalNeedKey,
) (*models.OperationalNeed, error)

OperationalNeedGetByModelPlanIDAndType existing OperationalNeed associated to a model plan by id and type

func (*Store) OperationalNeedInsertAllPossible

func (s *Store) OperationalNeedInsertAllPossible(
	np sqlutils.NamedPreparer,
	_ *zap.Logger,
	modelPlanID uuid.UUID,
	createdBy uuid.UUID,
) ([]*models.OperationalNeed, error)

OperationalNeedInsertAllPossible will insert all possible operational need in the DB for a specific model pland

func (*Store) OperationalNeedInsertOrUpdate

func (s *Store) OperationalNeedInsertOrUpdate(
	logger *zap.Logger,
	need *models.OperationalNeed,
	needTypeKey models.OperationalNeedKey,
) (*models.OperationalNeed, error)

OperationalNeedInsertOrUpdate either inserts or updates an operational need in the DB

func (*Store) OperationalNeedInsertOrUpdateOther

func (s *Store) OperationalNeedInsertOrUpdateOther(
	logger *zap.Logger,
	need *models.OperationalNeed,
	customNeedType string,
) (*models.OperationalNeed, error)

OperationalNeedInsertOrUpdateOther either inserts or updates a custom operational need in the DB

func (*Store) OperationalNeedUpdateByID

func (s *Store) OperationalNeedUpdateByID(
	logger *zap.Logger,
	need *models.OperationalNeed,
) (*models.OperationalNeed, error)

OperationalNeedUpdateByID will update an operational need in the DB

func (*Store) OperationalSolutionAndPossibleCollectionGetByOperationalNeedIDLOADER

func (s *Store) OperationalSolutionAndPossibleCollectionGetByOperationalNeedIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.OperationalSolution, error)

OperationalSolutionAndPossibleCollectionGetByOperationalNeedIDLOADER returns Operational Solutions that match the paramTable JSON

func (*Store) OperationalSolutionGetByID

func (s *Store) OperationalSolutionGetByID(_ *zap.Logger, id uuid.UUID) (*models.OperationalSolution, error)

OperationalSolutionGetByID returns an operational solution by ID

func (*Store) OperationalSolutionInsert

func (s *Store) OperationalSolutionInsert(
	logger *zap.Logger,
	solution *models.OperationalSolution,
	solutionTypeKey *models.OperationalSolutionKey,
) (*models.OperationalSolution, error)

OperationalSolutionInsert inserts an operational solution if it already exists

func (*Store) OperationalSolutionSubtaskDelete

func (s *Store) OperationalSolutionSubtaskDelete(
	logger *zap.Logger,
	id uuid.UUID,
	userID uuid.UUID,
) (sql.Result, error)

OperationalSolutionSubtaskDelete deletes an operational solution subtask by id

func (*Store) OperationalSolutionSubtaskGetByID

func (s *Store) OperationalSolutionSubtaskGetByID(
	_ *zap.Logger,
	subtaskID uuid.UUID,
) (*models.OperationalSolutionSubtask, error)

OperationalSolutionSubtaskGetByID gets a models.OperationalSolutionSubtask by ID

func (*Store) OperationalSolutionSubtaskGetByModelPlanIDLOADER

func (s *Store) OperationalSolutionSubtaskGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.OperationalSolutionSubtask, error)

OperationalSolutionSubtaskGetByModelPlanIDLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) OperationalSolutionSubtasksCreate

func (s *Store) OperationalSolutionSubtasksCreate(
	_ *zap.Logger,
	subtasks []*models.OperationalSolutionSubtask,
) ([]*models.OperationalSolutionSubtask, error)

OperationalSolutionSubtasksCreate creates a models.OperationalSolutionSubtask

func (*Store) OperationalSolutionSubtasksUpdate

func (s *Store) OperationalSolutionSubtasksUpdate(
	_ *zap.Logger,
	subtasks []*models.OperationalSolutionSubtask,
) ([]*models.OperationalSolutionSubtask, error)

OperationalSolutionSubtasksUpdate updates a collection of operational solution subtasks by ID

func (*Store) OperationalSolutionUpdateByID

func (s *Store) OperationalSolutionUpdateByID(
	logger *zap.Logger,
	solution *models.OperationalSolution,
) (*models.OperationalSolution, error)

OperationalSolutionUpdateByID updates an operational solution by its ID

func (*Store) PlanBasicsCreate

func (s *Store) PlanBasicsCreate(np sqlutils.NamedPreparer, logger *zap.Logger, basics *models.PlanBasics) (*models.PlanBasics, error)

PlanBasicsCreate creates a new plan basics

func (*Store) PlanBasicsGetByID

func (s *Store) PlanBasicsGetByID(_ *zap.Logger, id uuid.UUID) (*models.PlanBasics, error)

PlanBasicsGetByID returns the plan basics for a given id

func (*Store) PlanBasicsGetByModelPlanIDLOADER

func (s *Store) PlanBasicsGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.PlanBasics, error)

PlanBasicsGetByModelPlanIDLOADER returns the plan basics for a slice of model plan ids

func (*Store) PlanBasicsUpdate

func (s *Store) PlanBasicsUpdate(logger *zap.Logger, plan *models.PlanBasics) (*models.PlanBasics, error)

PlanBasicsUpdate updates the plan basics for a given id

func (*Store) PlanBeneficiariesCreate

func (s *Store) PlanBeneficiariesCreate(
	np sqlutils.NamedPreparer,
	logger *zap.Logger,
	b *models.PlanBeneficiaries,
) (*models.PlanBeneficiaries, error)

PlanBeneficiariesCreate creates a new plan benficiaries object

func (*Store) PlanBeneficiariesGetByID

func (s *Store) PlanBeneficiariesGetByID(
	_ *zap.Logger,
	id uuid.UUID,
) (*models.PlanBeneficiaries, error)

PlanBeneficiariesGetByID returns the plan general characteristics for a given id

func (*Store) PlanBeneficiariesGetByModelPlanIDLOADER

func (s *Store) PlanBeneficiariesGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.PlanBeneficiaries, error)

PlanBeneficiariesGetByModelPlanIDLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) PlanBeneficiariesUpdate

func (s *Store) PlanBeneficiariesUpdate(
	logger *zap.Logger,
	b *models.PlanBeneficiaries,
) (*models.PlanBeneficiaries, error)

PlanBeneficiariesUpdate updates the plan general characteristics for a given id

func (*Store) PlanCRCreate

func (s *Store) PlanCRCreate(logger *zap.Logger, planCR *models.PlanCR) (*models.PlanCR, error)

PlanCRCreate creates returns a plan_cr_tdl object

func (*Store) PlanCRDelete

func (s *Store) PlanCRDelete(_ *zap.Logger, id uuid.UUID, userID uuid.UUID) (*models.PlanCR, error)

PlanCRDelete deletes a plan_cr_tdl

func (*Store) PlanCRGetByID

func (s *Store) PlanCRGetByID(_ *zap.Logger, id uuid.UUID) (*models.PlanCR, error)

PlanCRGetByID returns a plan_cr_tdl

func (*Store) PlanCRUpdate

func (s *Store) PlanCRUpdate(logger *zap.Logger, planCR *models.PlanCR) (*models.PlanCR, error)

PlanCRUpdate updates and returns a plan_cr_tdl object

func (*Store) PlanCRsGetByModelPlanID

func (s *Store) PlanCRsGetByModelPlanID(_ *zap.Logger, modelPlanID uuid.UUID) ([]*models.PlanCR, error)

PlanCRsGetByModelPlanID returns all plan_cr_tdls associated with a model plan

func (*Store) PlanCollaboratorCreate

func (s *Store) PlanCollaboratorCreate(
	np sqlutils.NamedPreparer,
	_ *zap.Logger,
	collaborator *models.PlanCollaborator,
) (*models.PlanCollaborator, error)

PlanCollaboratorCreate creates a new plan collaborator

func (*Store) PlanCollaboratorDelete

func (s *Store) PlanCollaboratorDelete(
	_ *zap.Logger,
	id uuid.UUID,
	userID uuid.UUID,
) (*models.PlanCollaborator, error)

PlanCollaboratorDelete deletes the plan collaborator for a given id

func (*Store) PlanCollaboratorGetByID

func (s *Store) PlanCollaboratorGetByID(id uuid.UUID) (*models.PlanCollaborator, error)

PlanCollaboratorGetByID returns a plan collaborator for a given database ID, or nil if none found Note: The dataloader method should be preferred over this method.

func (*Store) PlanCollaboratorGetByModelPlanIDLOADER

func (s *Store) PlanCollaboratorGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.PlanCollaborator, error)

PlanCollaboratorGetByModelPlanIDLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) PlanCollaboratorUpdate

func (s *Store) PlanCollaboratorUpdate(
	_ *zap.Logger,
	collaborator *models.PlanCollaborator,
) (*models.PlanCollaborator, error)

PlanCollaboratorUpdate updates the plan collaborator for a given id

func (*Store) PlanDiscussionByID

func (s *Store) PlanDiscussionByID(_ *zap.Logger, id uuid.UUID) (*models.PlanDiscussion, error)

PlanDiscussionByID retrieves the plan discussion for a given id

func (*Store) PlanDiscussionCreate

func (s *Store) PlanDiscussionCreate(
	logger *zap.Logger,
	discussion *models.PlanDiscussion,
	np sqlutils.NamedPreparer,
) (*models.PlanDiscussion, error)

PlanDiscussionCreate creates a plan discussion the method is expected to be part of a larger transaction and does not handle committing or rollingback the transactions if the *sqlx.Tx is nil, this function will create one. The returned tx is the same as the one in the parameters.

func (*Store) PlanDiscussionDelete

func (s *Store) PlanDiscussionDelete(
	_ *zap.Logger,
	id uuid.UUID,
	userID uuid.UUID,
) (*models.PlanDiscussion, error)

PlanDiscussionDelete deletes the plan discussion for a given id

func (*Store) PlanDiscussionGetByModelPlanIDLOADER

func (s *Store) PlanDiscussionGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.PlanDiscussion, error)

PlanDiscussionGetByModelPlanIDLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) PlanDiscussionUpdate

func (s *Store) PlanDiscussionUpdate(
	logger *zap.Logger,
	discussion *models.PlanDiscussion,
) (*models.PlanDiscussion, error)

PlanDiscussionUpdate updates a plan discussion object

func (*Store) PlanDocumentCreate

func (s *Store) PlanDocumentCreate(
	logger *zap.Logger,
	principal string,
	inputDocument *models.PlanDocument) (*models.PlanDocument, error)

PlanDocumentCreate creates a plan document

func (*Store) PlanDocumentDelete

func (s *Store) PlanDocumentDelete(logger *zap.Logger, id uuid.UUID, userID uuid.UUID) (sql.Result, error)

PlanDocumentDelete deletes a plan document object by id

func (*Store) PlanDocumentNumLinkedSolutions

func (s *Store) PlanDocumentNumLinkedSolutions(logger *zap.Logger, documentID uuid.UUID) (int, error)

PlanDocumentNumLinkedSolutions implements store logic to retrieve the number of linked solutions for a document by ID

func (*Store) PlanDocumentRead

func (s *Store) PlanDocumentRead(
	_ *zap.Logger,
	s3Client *upload.S3Client,
	id uuid.UUID,
) (*models.PlanDocument, error)

PlanDocumentRead reads a plan document object by id

func (*Store) PlanDocumentSolutionLinkGetByIDs

func (s *Store) PlanDocumentSolutionLinkGetByIDs(
	_ *zap.Logger,
	solutionID uuid.UUID,
	documentID uuid.UUID,
) (*models.PlanDocumentSolutionLink, error)

PlanDocumentSolutionLinkGetByIDs returns a single plan document solution link by ID

func (*Store) PlanDocumentSolutionLinksCreate

func (s *Store) PlanDocumentSolutionLinksCreate(
	_ *zap.Logger,
	solutionID uuid.UUID,
	documentIDs []uuid.UUID,
	principal authentication.Principal,
) ([]*models.PlanDocumentSolutionLink, error)

PlanDocumentSolutionLinksCreate creates a collection of plan document solution links

func (*Store) PlanDocumentSolutionLinksGetBySolutionID

func (s *Store) PlanDocumentSolutionLinksGetBySolutionID(
	logger *zap.Logger,
	solutionID uuid.UUID,
) ([]*models.PlanDocumentSolutionLink, error)

PlanDocumentSolutionLinksGetBySolutionID gets a list of document solution links associated with the given plan ID

func (*Store) PlanDocumentSolutionLinksRemove

func (s *Store) PlanDocumentSolutionLinksRemove(
	logger *zap.Logger,
	solutionID uuid.UUID,
	documentIDs []uuid.UUID,
	userID uuid.UUID,
) (bool, error)

PlanDocumentSolutionLinksRemove deletes a plan document object by id

func (*Store) PlanDocumentUpdate

func (s *Store) PlanDocumentUpdate(logger *zap.Logger, plan *models.PlanDocument) (*models.PlanDocument, error)

PlanDocumentUpdate updates a plan document object by id with provided values

func (*Store) PlanDocumentsReadByModelPlanID

func (s *Store) PlanDocumentsReadByModelPlanID(
	logger *zap.Logger,
	modelPlanID uuid.UUID,
	s3Client *upload.S3Client) ([]*models.PlanDocument, error)

PlanDocumentsReadByModelPlanID reads a plan document object by model plan id

func (*Store) PlanDocumentsReadByModelPlanIDNotRestricted

func (s *Store) PlanDocumentsReadByModelPlanIDNotRestricted(
	logger *zap.Logger,
	modelPlanID uuid.UUID,
	s3Client *upload.S3Client) ([]*models.PlanDocument, error)

PlanDocumentsReadByModelPlanIDNotRestricted reads a plan document object by model plan id and restricted = false

func (*Store) PlanDocumentsReadBySolutionID

func (s *Store) PlanDocumentsReadBySolutionID(
	logger *zap.Logger,
	solutionID uuid.UUID,
	s3Client *upload.S3Client) ([]*models.PlanDocument, error)

PlanDocumentsReadBySolutionID reads a plan document object by solution id

func (*Store) PlanDocumentsReadBySolutionIDNotRestricted

func (s *Store) PlanDocumentsReadBySolutionIDNotRestricted(
	logger *zap.Logger,
	solutionID uuid.UUID,
	s3Client *upload.S3Client) ([]*models.PlanDocument, error)

PlanDocumentsReadBySolutionIDNotRestricted reads a plan document object by model plan id and restricted = false

func (*Store) PlanFavoriteCollectionGetUniqueUserIDs

func (s *Store) PlanFavoriteCollectionGetUniqueUserIDs() ([]uuid.UUID, error)

PlanFavoriteCollectionGetUniqueUserIDs returns userIDs of users that have favorited any model

func (*Store) PlanFavoriteCreate

func (s *Store) PlanFavoriteCreate(np sqlutils.NamedPreparer, logger *zap.Logger, favorite models.PlanFavorite) (*models.PlanFavorite, error)

PlanFavoriteCreate creates and returns a plan favorite object

func (*Store) PlanFavoriteDelete

func (s *Store) PlanFavoriteDelete(
	_ *zap.Logger,
	userAccountID uuid.UUID,
	planID uuid.UUID,
	deletedByUserID uuid.UUID,
) (*models.PlanFavorite, error)

PlanFavoriteDelete deletes a plan favorite

func (*Store) PlanFavoriteGetByModelIDAndUserAccountID

func (s *Store) PlanFavoriteGetByModelIDAndUserAccountID(
	_ *zap.Logger,
	userAccountID uuid.UUID,
	modelPlanID uuid.UUID,
) (*models.PlanFavorite, error)

PlanFavoriteGetByModelIDAndUserAccountID returns a plan favorite

func (*Store) PlanGeneralCharacteristicsCreate

func (s *Store) PlanGeneralCharacteristicsCreate(
	np sqlutils.NamedPreparer,
	logger *zap.Logger,
	gc *models.PlanGeneralCharacteristics,
) (*models.PlanGeneralCharacteristics, error)

PlanGeneralCharacteristicsCreate creates a new plan basics

func (*Store) PlanGeneralCharacteristicsGetByID

func (s *Store) PlanGeneralCharacteristicsGetByID(
	_ *zap.Logger,
	id uuid.UUID,
) (*models.PlanGeneralCharacteristics, error)

PlanGeneralCharacteristicsGetByID returns the plan general characteristics for a given id

func (*Store) PlanGeneralCharacteristicsGetByModelPlanIDLOADER

func (s *Store) PlanGeneralCharacteristicsGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.PlanGeneralCharacteristics, error)

PlanGeneralCharacteristicsGetByModelPlanIDLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) PlanGeneralCharacteristicsUpdate

func (s *Store) PlanGeneralCharacteristicsUpdate(
	logger *zap.Logger,
	gc *models.PlanGeneralCharacteristics,
) (*models.PlanGeneralCharacteristics, error)

PlanGeneralCharacteristicsUpdate updates the plan general characteristics for a given id

func (*Store) PlanOpsEvalAndLearningCreate

func (s *Store) PlanOpsEvalAndLearningCreate(
	np sqlutils.NamedPreparer,
	logger *zap.Logger,
	oel *models.PlanOpsEvalAndLearning,
) (*models.PlanOpsEvalAndLearning, error)

PlanOpsEvalAndLearningCreate creates a new plan providers_and_participants object

func (*Store) PlanOpsEvalAndLearningGetByID

func (s *Store) PlanOpsEvalAndLearningGetByID(
	_ *zap.Logger,
	id uuid.UUID,
) (*models.PlanOpsEvalAndLearning, error)

PlanOpsEvalAndLearningGetByID returns the plan providers_and_participants for a given id

func (*Store) PlanOpsEvalAndLearningGetByModelPlanIDLOADER

func (s *Store) PlanOpsEvalAndLearningGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.PlanOpsEvalAndLearning, error)

PlanOpsEvalAndLearningGetByModelPlanIDLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) PlanOpsEvalAndLearningUpdate

func (s *Store) PlanOpsEvalAndLearningUpdate(
	logger *zap.Logger,
	oel *models.PlanOpsEvalAndLearning,
) (*models.PlanOpsEvalAndLearning, error)

PlanOpsEvalAndLearningUpdate updates the plan providers_and_participants for a given id

func (*Store) PlanParticipantsAndProvidersCreate

func (s *Store) PlanParticipantsAndProvidersCreate(
	np sqlutils.NamedPreparer,
	logger *zap.Logger,
	gc *models.PlanParticipantsAndProviders,
) (*models.PlanParticipantsAndProviders, error)

PlanParticipantsAndProvidersCreate creates a new plan providers_and_participants object

func (*Store) PlanParticipantsAndProvidersGetByID

func (s *Store) PlanParticipantsAndProvidersGetByID(
	_ *zap.Logger,
	id uuid.UUID,
) (*models.PlanParticipantsAndProviders, error)

PlanParticipantsAndProvidersGetByID returns the plan providers_and_participants for a given id

func (*Store) PlanParticipantsAndProvidersGetByModelPlanIDLOADER

func (s *Store) PlanParticipantsAndProvidersGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.PlanParticipantsAndProviders, error)

PlanParticipantsAndProvidersGetByModelPlanIDLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) PlanParticipantsAndProvidersUpdate

func (s *Store) PlanParticipantsAndProvidersUpdate(
	logger *zap.Logger,
	gc *models.PlanParticipantsAndProviders,
) (*models.PlanParticipantsAndProviders, error)

PlanParticipantsAndProvidersUpdate updates the plan providers_and_participants for a given id

func (*Store) PlanPaymentsCreate

func (s *Store) PlanPaymentsCreate(
	np sqlutils.NamedPreparer,
	logger *zap.Logger,
	payments *models.PlanPayments) (*models.PlanPayments, error)

PlanPaymentsCreate creates a new plan payments row in the database and returns a copy to the caller

func (*Store) PlanPaymentsGetByModelPlanIDLOADER

func (s *Store) PlanPaymentsGetByModelPlanIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.PlanPayments, error)

PlanPaymentsGetByModelPlanIDLOADER returns the plan GeneralCharacteristics for a slice of model plan ids

func (*Store) PlanPaymentsRead

func (s *Store) PlanPaymentsRead(
	_ *zap.Logger,
	id uuid.UUID) (*models.PlanPayments, error)

PlanPaymentsRead finds a plan payments model by id

func (*Store) PlanPaymentsUpdate

func (s *Store) PlanPaymentsUpdate(
	logger *zap.Logger,
	payments *models.PlanPayments) (*models.PlanPayments, error)

PlanPaymentsUpdate updates a plan payment model in the database

func (*Store) PlanTDLCreate

func (s *Store) PlanTDLCreate(logger *zap.Logger, planTDL *models.PlanTDL) (*models.PlanTDL, error)

PlanTDLCreate creates returns a plan_cr_tdl object

func (*Store) PlanTDLDelete

func (s *Store) PlanTDLDelete(_ *zap.Logger, id uuid.UUID, userID uuid.UUID) (*models.PlanTDL, error)

PlanTDLDelete deletes a plan_cr_tdl

func (*Store) PlanTDLGetByID

func (s *Store) PlanTDLGetByID(_ *zap.Logger, id uuid.UUID) (*models.PlanTDL, error)

PlanTDLGetByID returns a plan_cr_tdl

func (*Store) PlanTDLUpdate

func (s *Store) PlanTDLUpdate(logger *zap.Logger, planTDL *models.PlanTDL) (*models.PlanTDL, error)

PlanTDLUpdate updates and returns a plan_cr_tdl object

func (*Store) PlanTDLsGetByModelPlanID

func (s *Store) PlanTDLsGetByModelPlanID(_ *zap.Logger, modelPlanID uuid.UUID) ([]*models.PlanTDL, error)

PlanTDLsGetByModelPlanID returns all plan_cr_tdls associated with a model plan

func (*Store) PossibleOperationalNeedCollectionGetByModelPlanID

func (s *Store) PossibleOperationalNeedCollectionGetByModelPlanID(
	_ *zap.Logger,
	modelPlanID uuid.UUID,
) ([]*models.PossibleOperationalNeed, error)

PossibleOperationalNeedCollectionGetByModelPlanID returns possible operational needs that don't have an existing record for a model plan

func (*Store) PossibleOperationalSolutionCollectionGetAll

func (s *Store) PossibleOperationalSolutionCollectionGetAll(_ *zap.Logger) (
	[]*models.PossibleOperationalSolution,
	error,
)

PossibleOperationalSolutionCollectionGetAll returns all possible operational solutions

func (*Store) PossibleOperationalSolutionCollectionGetByNeedType

func (s *Store) PossibleOperationalSolutionCollectionGetByNeedType(
	_ *zap.Logger,
	needKey models.OperationalNeedKey,
) ([]*models.PossibleOperationalSolution, error)

PossibleOperationalSolutionCollectionGetByNeedType returns possible operational solutions for a given operational need

func (*Store) PossibleOperationalSolutionCollectionGetByOperationalNeedID

func (s *Store) PossibleOperationalSolutionCollectionGetByOperationalNeedID(
	_ *zap.Logger,
	operationalNeedID uuid.UUID,
) ([]*models.PossibleOperationalSolution, error)

PossibleOperationalSolutionCollectionGetByOperationalNeedID returns possible operational solutions for a given operational need

func (*Store) PossibleOperationalSolutionContactsGetByPossibleSolutionIDLOADER

func (s *Store) PossibleOperationalSolutionContactsGetByPossibleSolutionIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*models.PossibleOperationalSolutionContact, error)

PossibleOperationalSolutionContactsGetByPossibleSolutionIDLOADER returns Solution contacts that match the paramTable JSON

func (*Store) PossibleOperationalSolutionGetByID

func (s *Store) PossibleOperationalSolutionGetByID(logger *zap.Logger, id int) (*models.PossibleOperationalSolution, error)

PossibleOperationalSolutionGetByID returns a possible solution associated to a specific id

func (*Store) PossibleOperationalSolutionGetByKey

func (s *Store) PossibleOperationalSolutionGetByKey(logger *zap.Logger, solKey models.OperationalSolutionKey) (*models.PossibleOperationalSolution, error)

PossibleOperationalSolutionGetByKey returns a possible solution associated to a specific id

func (*Store) PossibleOperationalSolutionPrimaryContactGetByPossibleSolutionID

func (s *Store) PossibleOperationalSolutionPrimaryContactGetByPossibleSolutionID(
	np sqlutils.NamedPreparer,
	logger *zap.Logger,
	possibleSolutionID int,
) (*models.PossibleOperationalSolutionContact, error)

PossibleOperationalSolutionPrimaryContactGetByPossibleSolutionID returns the primary contact associated with a possible operational solution

func (*Store) PrepareNamed

func (s *Store) PrepareNamed(query string) (*sqlx.NamedStmt, error)

PrepareNamed implements the INamedPreparer interface Implementing the sqlutils.NamedPreparer interface allows us to use a sqlx.Tx or a storage.Store as a parameter in our DB calls (the former for when we want to implement transactions, the latter for when we don't)

func (*Store) ReadyForClearanceGetByModelPlanID

func (s *Store) ReadyForClearanceGetByModelPlanID(
	_ *zap.Logger,
	modelPlanID uuid.UUID,
) (*models.PrepareForClearanceResponse, error)

ReadyForClearanceGetByModelPlanID reads information about a model plan's clearance

func (*Store) TagCollectionGetByContentIDAndField

func (s *Store) TagCollectionGetByContentIDAndField(_ *zap.Logger, taggedTable string, taggedField string, taggedContentID uuid.UUID) ([]*models.Tag, error)

TagCollectionGetByContentIDAndField returns relevant tags for specific table and field

func (*Store) TagCreate

func (s *Store) TagCreate(
	logger *zap.Logger,
	tag *models.Tag,
) (*models.Tag, error)

TagCreate writes a new tage to the database

func (*Store) TruncateAllTablesDANGEROUS

func (s *Store) TruncateAllTablesDANGEROUS(logger *zap.Logger) error

TruncateAllTablesDANGEROUS is a function to reset all tables in the DB. It should only be called within test code.

func (*Store) UserAccountGetByIDLOADER

func (s *Store) UserAccountGetByIDLOADER(
	_ *zap.Logger,
	paramTableJSON string,
) ([]*authentication.UserAccount, error)

UserAccountGetByIDLOADER gets multiple User account from the database by its internal id.

Directories

Path Synopsis
Package loaders is a responsible for batched data calls
Package loaders is a responsible for batched data calls

Jump to

Keyboard shortcuts

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