Documentation ¶
Index ¶
- func CTXWithLoaders(ctx context.Context, buildDataloaders BuildDataloaders) context.Context
- func FetchUserInfoByEUAUserID(ctx context.Context, euaUserID string) (*models.UserInfo, error)
- func GetBusinessCaseLifecycleCostsByBizCaseID(ctx context.Context, businessCaseID uuid.UUID) ([]*models.EstimatedLifecycleCost, error)
- func GetCedarSystemByID(ctx context.Context, cedarSystemID string) (*models.CedarSystem, error)
- func GetCedarSystemIsBookmarked(ctx context.Context, cedarSystemID string, euaUserID string) (bool, error)
- func GetCedarSystemLinkedSystemIntakes(ctx context.Context, cedarSystemID string, state models.SystemIntakeState) ([]*models.SystemIntake, error)
- func GetCedarSystemLinkedTRBRequests(ctx context.Context, cedarSystemID string, state models.TRBRequestState) ([]*models.TRBRequest, error)
- func GetNewestTRBRequestFeedbackByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) (*models.TRBRequestFeedback, error)
- func GetRelatedSystemIntakesBySystemIntakeID(ctx context.Context, intakeID uuid.UUID) ([]*models.SystemIntake, error)
- func GetRelatedSystemIntakesByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.SystemIntake, error)
- func GetRelatedTRBRequestsBySystemIntakeID(ctx context.Context, intakeID uuid.UUID) ([]*models.TRBRequest, error)
- func GetRelatedTRBRequestsByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.TRBRequest, error)
- func GetSystemIntakeActionsBySystemIntakeID(ctx context.Context, systemIntakeID uuid.UUID) ([]*models.Action, error)
- func GetSystemIntakeBusinessCaseBySystemIntakeID(ctx context.Context, systemIntakeID uuid.UUID) (*models.BusinessCase, error)
- func GetSystemIntakeContractNumbersBySystemIntakeID(ctx context.Context, systemIntakeID uuid.UUID) ([]*models.SystemIntakeContractNumber, error)
- func GetSystemIntakeDocumentsBySystemIntakeID(ctx context.Context, systemIntakeID uuid.UUID) ([]*models.SystemIntakeDocument, error)
- func GetSystemIntakeFundingSourceBySystemIntakeID(ctx context.Context, systemIntakeID uuid.UUID) ([]*models.SystemIntakeFundingSource, error)
- func GetSystemIntakeGRBReviewersBySystemIntakeID(ctx context.Context, systemIntakeID uuid.UUID) ([]*models.SystemIntakeGRBReviewer, error)
- func GetSystemIntakeGovReqFeedbackByIntakeID(ctx context.Context, systemIntakeID uuid.UUID) ([]*models.GovernanceRequestFeedback, error)
- func GetSystemIntakeNotesBySystemIntakeID(ctx context.Context, systemIntakeID uuid.UUID) ([]*models.SystemIntakeNote, error)
- func GetSystemIntakeSystemsBySystemIntakeID(ctx context.Context, systemIntakeID uuid.UUID) ([]*models.SystemIntakeSystem, error)
- func GetTRBAdminNotesByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.TRBAdminNote, error)
- func GetTRBAttendeeByEUAIDAndTRBRequestID(ctx context.Context, euaID string, trbRequestID uuid.UUID) (*models.TRBRequestAttendee, error)
- func GetTRBAttendeesByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.TRBRequestAttendee, error)
- func GetTRBFundingSourcesByRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.TRBFundingSource, error)
- func GetTRBGuidanceLetterByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) (*models.TRBGuidanceLetter, error)
- func GetTRBRequestContractNumbersByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.TRBRequestContractNumber, error)
- func GetTRBRequestDocumentsByRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.TRBRequestDocument, error)
- func GetTRBRequestFeedbackByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.TRBRequestFeedback, error)
- func GetTRBRequestFormByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) (*models.TRBRequestForm, error)
- func GetTRBRequestFormSystemIntakesByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.SystemIntake, error)
- func GetTRBRequestSystemsByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.TRBRequestSystem, error)
- func GetUserAccountByID(ctx context.Context, userID uuid.UUID) (*authentication.UserAccount, error)
- func NewDataloaderMiddleware(buildDataloaders BuildDataloaders) mux.MiddlewareFunc
- type BuildDataloaders
- type Dataloaders
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CTXWithLoaders ¶
func CTXWithLoaders(ctx context.Context, buildDataloaders BuildDataloaders) context.Context
CTXWithLoaders sets the given dataloaders onto given context
func GetCedarSystemByID ¶
func GetCedarSystemLinkedSystemIntakes ¶
func GetCedarSystemLinkedSystemIntakes(ctx context.Context, cedarSystemID string, state models.SystemIntakeState) ([]*models.SystemIntake, error)
func GetCedarSystemLinkedTRBRequests ¶
func GetCedarSystemLinkedTRBRequests(ctx context.Context, cedarSystemID string, state models.TRBRequestState) ([]*models.TRBRequest, error)
func GetRelatedSystemIntakesBySystemIntakeID ¶
func GetRelatedSystemIntakesBySystemIntakeID(ctx context.Context, intakeID uuid.UUID) ([]*models.SystemIntake, error)
GetRelatedSystemIntakesBySystemIntakeID gets related intakes by intake ID
func GetRelatedSystemIntakesByTRBRequestID ¶
func GetRelatedSystemIntakesByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.SystemIntake, error)
GetRelatedSystemIntakesByTRBRequestID gets related system intakes by TRB Request ID
func GetRelatedTRBRequestsBySystemIntakeID ¶
func GetRelatedTRBRequestsBySystemIntakeID(ctx context.Context, intakeID uuid.UUID) ([]*models.TRBRequest, error)
GetRelatedTRBRequestsBySystemIntakeID gets related TRB Requests by system intake ID
func GetRelatedTRBRequestsByTRBRequestID ¶
func GetRelatedTRBRequestsByTRBRequestID(ctx context.Context, trbRequestID uuid.UUID) ([]*models.TRBRequest, error)
GetRelatedTRBRequestsByTRBRequestID gets related TRB Requests by TRB Request ID
func GetUserAccountByID ¶
func GetUserAccountByID(ctx context.Context, userID uuid.UUID) (*authentication.UserAccount, error)
func NewDataloaderMiddleware ¶
func NewDataloaderMiddleware(buildDataloaders BuildDataloaders) mux.MiddlewareFunc
Types ¶
type BuildDataloaders ¶
type BuildDataloaders func() *Dataloaders
BuildDataloaders builds and returns a set of dataloaders - useful for supplying each new HTTP request with its own set of dataloaders
type Dataloaders ¶
type Dataloaders struct { BusinessCaseLifecycleCosts *dataloadgen.Loader[uuid.UUID, []*models.EstimatedLifecycleCost] CedarSystemBookmark *dataloadgen.Loader[models.BookmarkRequest, bool] CedarSystemLinkedSystemIntakes *dataloadgen.Loader[models.SystemIntakesByCedarSystemIDsRequest, []*models.SystemIntake] CedarSystemLinkedTRBRequests *dataloadgen.Loader[models.TRBRequestsByCedarSystemIDsRequest, []*models.TRBRequest] FetchUserInfo *dataloadgen.Loader[string, *models.UserInfo] GetUserAccount *dataloadgen.Loader[uuid.UUID, *authentication.UserAccount] GetCedarSystem *dataloadgen.Loader[string, *models.CedarSystem] SystemIntakeActions *dataloadgen.Loader[uuid.UUID, []*models.Action] SystemIntakeBusinessCase *dataloadgen.Loader[uuid.UUID, *models.BusinessCase] SystemIntakeContractNumbers *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeContractNumber] SystemIntakeDocuments *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeDocument] SystemIntakeFundingSources *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeFundingSource] SystemIntakeGovReqFeedback *dataloadgen.Loader[uuid.UUID, []*models.GovernanceRequestFeedback] SystemIntakeGRBReviewers *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeGRBReviewer] SystemIntakeNotes *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeNote] SystemIntakeRelatedSystemIntakes *dataloadgen.Loader[uuid.UUID, []*models.SystemIntake] SystemIntakeRelatedTRBRequests *dataloadgen.Loader[uuid.UUID, []*models.TRBRequest] SystemIntakeSystems *dataloadgen.Loader[uuid.UUID, []*models.SystemIntakeSystem] TRBFundingSources *dataloadgen.Loader[uuid.UUID, []*models.TRBFundingSource] TRBRequestAdminNotes *dataloadgen.Loader[uuid.UUID, []*models.TRBAdminNote] TRBRequestGuidanceLetter *dataloadgen.Loader[uuid.UUID, *models.TRBGuidanceLetter] TRBRequestAttendees *dataloadgen.Loader[uuid.UUID, []*models.TRBRequestAttendee] TRBRequestAttendeeByEUA *dataloadgen.Loader[models.TRBAttendeeByTRBAndEUAIDRequest, *models.TRBRequestAttendee] TRBRequestContractNumbers *dataloadgen.Loader[uuid.UUID, []*models.TRBRequestContractNumber] TRBRequestDocuments *dataloadgen.Loader[uuid.UUID, []*models.TRBRequestDocument] TRBRequestForm *dataloadgen.Loader[uuid.UUID, *models.TRBRequestForm] TRBRequestFeedback *dataloadgen.Loader[uuid.UUID, []*models.TRBRequestFeedback] TRBRequestFeedbackNewest *dataloadgen.Loader[uuid.UUID, *models.TRBRequestFeedback] TRBRequestRelatedSystemIntakes *dataloadgen.Loader[uuid.UUID, []*models.SystemIntake] TRBRequestRelatedTRBRequests *dataloadgen.Loader[uuid.UUID, []*models.TRBRequest] TRBRequestSystems *dataloadgen.Loader[uuid.UUID, []*models.TRBRequestSystem] TRBRequestFormSystemIntakes *dataloadgen.Loader[uuid.UUID, []*models.SystemIntake] }
Dataloaders houses all dataloader-capable functionality to create a new dataloader, create a new property in this struct and give it the request type and return type for ONE item (i.e., even though you can pass a dataloader a list of UUIDs to get a list of UserAccounts, the definition must be one-one (request-response) - in this example [uuid.UUID, UserAccount])
then, create a file in this package and create two functions in there
- a method on the `dataReader` type - this is our batching function - this function will take a slice of the request type (in the example above, it would take []uuid.UUID) - this function will return a slice of the response type (in this example, []UserAccount)
- an exported function which takes/returns the one-one relationship defined below
example of this:
// take in a slice of inputs (uuids) and returns a slice of outputs (each uuid gets its own slice of `*models.SystemIntakeSystem`) func (d *dataReader) batchSystemIntakeSystemsBySystemIntakeIDs(ctx context.Context, systemIntakeIDs []uuid.UUID) ([][]*models.SystemIntakeSystem, []error) { data, err := d.db.SystemIntakeSystemsBySystemIntakeIDs(ctx, systemIntakeIDs) if err != nil { return nil, []error{err} } return helpers.OneToMany[*models.SystemIntakeSystem](systemIntakeIDs, data), nil } // take in a one-one relationship (a single uuid gets a single slice) func GetSystemIntakeSystemsBySystemIntakeID(ctx context.Context, systemIntakeID uuid.UUID) ([]*models.SystemIntakeSystem, error) { loaders, ok := loadersFromCTX(ctx) if !ok { return nil, errors.New("unexpected nil loaders in GetSystemIntakeSystemsBySystemIntakeID") } return loaders.SystemIntakeSystems.Load(ctx, systemIntakeID) }
you can then edit NewDataloaders below to include your new dataloader in the return
func NewDataloaders ¶
func NewDataloaders(store *storage.Store, fetchUserInfos fetchUserInfosFunc, getCedarSystems getCedarSystemsFunc) *Dataloaders
NewDataloaders returns a new set of dataloaders
Source Files ¶
- business_case_lifecycle_costs.go
- cedar_system.go
- cedar_system_bookmark.go
- cedar_system_linked_system_intakes.go
- cedar_system_linked_trb_requests.go
- context.go
- dataloaders.go
- fetch_user_account.go
- fetch_user_info.go
- middleware.go
- related_requests.go
- system_intake_actions.go
- system_intake_business_case.go
- system_intake_contract_number.go
- system_intake_document.go
- system_intake_funding_sources.go
- system_intake_gov_req_feedback.go
- system_intake_grb_reviewers.go
- system_intake_notes.go
- system_intake_systems.go
- trb_request_admin_notes.go
- trb_request_attendees.go
- trb_request_contract_number.go
- trb_request_documents.go
- trb_request_feedback.go
- trb_request_form_system_intakes.go
- trb_request_forms.go
- trb_request_funding_sources.go
- trb_request_guidance_letter.go
- trb_request_systems.go