loader

package
v0.1.28 Latest Latest
Warning

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

Go to latest
Published: May 24, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAftermarketDeviceByID added in v0.1.7

func GetAftermarketDeviceByID(ctx context.Context, id int) (*model.AftermarketDevice, error)

func GetAftermarketDeviceByVehicleID

func GetAftermarketDeviceByVehicleID(ctx context.Context, vehicleID int) (*model.AftermarketDevice, error)

func GetDCNByVehicleID

func GetDCNByVehicleID(ctx context.Context, vehicleID int) (*gmodel.Dcn, error)

func GetManufacturerID

func GetManufacturerID(ctx context.Context, manufacturerID int) (*model.Manufacturer, error)

func GetSyntheticDeviceByID added in v0.1.7

func GetSyntheticDeviceByID(ctx context.Context, vehicleID int) (*gmodel.SyntheticDevice, error)

func GetSyntheticDeviceByVehicleID

func GetSyntheticDeviceByVehicleID(ctx context.Context, vehicleID int) (*gmodel.SyntheticDevice, error)

func GetVehicleByID

func GetVehicleByID(ctx context.Context, vehicleID int) (*model.Vehicle, error)

func Middleware

func Middleware(db db.Store, next http.Handler, settings config.Settings) http.Handler

Middleware injects a DataLoader into the request context so it can be used later in the schema resolvers

Types

type AftermarketDeviceLoader

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

func (*AftermarketDeviceLoader) BatchGetAftermarketDeviceByID added in v0.1.7

func (ad *AftermarketDeviceLoader) BatchGetAftermarketDeviceByID(ctx context.Context, aftermarketDeviceIDs []int) []*dataloader.Result[*model.AftermarketDevice]

BatchGetAftermarketDeviceByID implements the dataloader for finding aftermarket devices by their ids and returns them in the order requested

func (*AftermarketDeviceLoader) BatchGetLinkedAftermarketDeviceByVehicleID

func (ad *AftermarketDeviceLoader) BatchGetLinkedAftermarketDeviceByVehicleID(ctx context.Context, vehicleIDs []int) []*dataloader.Result[*model.AftermarketDevice]

BatchGetLinkedAftermarketDeviceByVehicleID implements the dataloader for finding aftermarket devices linked to vehicles and returns them in the order requested

type DCNLoader

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

func (*DCNLoader) BatchGetDCNByVehicleID

func (d *DCNLoader) BatchGetDCNByVehicleID(ctx context.Context, vehicleIDs []int) []*dataloader.Result[*gmodel.Dcn]

BatchGetDCNByVehicleID implements the dataloader for finding DCN linked to vehicles and returns them in the order requested

type Loaders

type Loaders struct {
	VehicleByID                  dataloader.Interface[int, *model.Vehicle]
	AftermarketDeviceByVehicleID dataloader.Interface[int, *model.AftermarketDevice]
	SyntheticDeviceByVehicleID   dataloader.Interface[int, *model.SyntheticDevice]
	DCNByVehicleID               dataloader.Interface[int, *model.Dcn]
	ManufacturerByID             dataloader.Interface[int, *model.Manufacturer]
	AftermarketDeviceByID        dataloader.Interface[int, *model.AftermarketDevice]
	SyntheticDeviceByID          dataloader.Interface[int, *model.SyntheticDevice]
}

func NewDataLoader

func NewDataLoader(dbs db.Store, settings config.Settings) *Loaders

NewDataLoader returns the instantiated Loaders struct for use in a request

type ManufacturerLoader

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

func (*ManufacturerLoader) BatchGetManufacturerByID

func (v *ManufacturerLoader) BatchGetManufacturerByID(ctx context.Context, manufacturerIDs []int) []*dataloader.Result[*model.Manufacturer]

type SyntheticDeviceLoader

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

func (*SyntheticDeviceLoader) BatchGetSyntheticDeviceByID added in v0.1.7

func (sd *SyntheticDeviceLoader) BatchGetSyntheticDeviceByID(ctx context.Context, syntheticDeviceIDs []int) []*dataloader.Result[*gmodel.SyntheticDevice]

BatchGetSyntheticDeviceByVehicleID implements the dataloader for finding synthetic devices by their ids and returns them in the order requested

func (*SyntheticDeviceLoader) BatchGetSyntheticDeviceByVehicleID

func (sd *SyntheticDeviceLoader) BatchGetSyntheticDeviceByVehicleID(ctx context.Context, vehicleIDs []int) []*dataloader.Result[*gmodel.SyntheticDevice]

BatchGetSyntheticDeviceByVehicleID implements the dataloader for finding synthetic devices linked to vehicles and returns them in the order requested

type VehicleLoader

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

func (*VehicleLoader) BatchGetVehicleByID added in v0.1.7

func (v *VehicleLoader) BatchGetVehicleByID(ctx context.Context, vehicleIDs []int) []*dataloader.Result[*model.Vehicle]

BatchGetVehicleByID implements the dataloader for finding vehicles by their ids.

Jump to

Keyboard shortcuts

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