datarepository

package
v0.0.0-...-444540b Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrTypeAssertionError is thrown when type an interface does not match the asserted type
	ErrTypeAssertionError = errors.New("unable to assert type")
)

Functions

func AssertLocationDetailsRequired

func AssertLocationDetailsRequired(obj LocationDetails) error

AssertLocationDetailsRequired checks if the required fields are not zero-ed

func AssertLocationResponseRequired

func AssertLocationResponseRequired(obj LocationResponse) error

AssertLocationResponseRequired checks if the required fields are not zero-ed

func AssertRecurseInterfaceRequired

func AssertRecurseInterfaceRequired(obj interface{}, callback func(interface{}) error) error

AssertInterfaceRequired recursively checks each struct in a slice against the callback. This method traverse nested slices in a preorder fashion.

func AssertRecurseLocationDetailsRequired

func AssertRecurseLocationDetailsRequired(objSlice interface{}) error

AssertRecurseLocationDetailsRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of LocationDetails (e.g. [][]LocationDetails), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseLocationResponseRequired

func AssertRecurseLocationResponseRequired(objSlice interface{}) error

AssertRecurseLocationResponseRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of LocationResponse (e.g. [][]LocationResponse), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseSubIdsRequired

func AssertRecurseSubIdsRequired(objSlice interface{}) error

AssertRecurseSubIdsRequired recursively checks if required fields are not zero-ed in a nested slice. Accepts only nested slice of SubIds (e.g. [][]SubIds), otherwise ErrTypeAssertionError is thrown.

func AssertRecurseValueRequired

func AssertRecurseValueRequired(value reflect.Value, callback func(interface{}) error) error

AssertNestedValueRequired checks each struct in the nested slice against the callback. This method traverse nested slices in a preorder fashion.

func AssertSubIdsRequired

func AssertSubIdsRequired(obj SubIds) error

AssertSubIdsRequired checks if the required fields are not zero-ed

func DefaultErrorHandler

func DefaultErrorHandler(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)

DefaultErrorHandler defines the default logic on how to handle errors from the controller. Any errors from parsing request params will return a StatusBadRequest. Otherwise, the error code originating from the servicer will be used.

func EncodeJSONResponse

func EncodeJSONResponse(i interface{}, status *int, w http.ResponseWriter) error

EncodeJSONResponse uses the json encoder to write an interface to the http response with an optional status code

func IsZeroValue

func IsZeroValue(val interface{}) bool

IsZeroValue checks if the val is the zero-ed value.

func Logger

func Logger(inner http.Handler, name string) http.Handler

func NewRouter

func NewRouter(routers ...Router) *mux.Router

NewRouter creates a new router for any number of api routers

func ReadFormFileToTempFile

func ReadFormFileToTempFile(r *http.Request, key string) (*os.File, error)

ReadFormFileToTempFile reads file data from a request form and writes it to a temporary file

func ReadFormFilesToTempFiles

func ReadFormFilesToTempFiles(r *http.Request, key string) ([]*os.File, error)

ReadFormFilesToTempFiles reads files array data from a request form and writes it to a temporary files

Types

type ErrorHandler

type ErrorHandler func(w http.ResponseWriter, r *http.Request, err error, result *ImplResponse)

ErrorHandler defines the required method for handling error. You may implement it and inject this into a controller if you would like errors to be handled differently from the DefaultErrorHandler

type ImplResponse

type ImplResponse struct {
	Code int
	Body interface{}
}

Implementation response defines an error code with the associated body

func Response

func Response(code int, body interface{}) ImplResponse

Response return a ImplResponse struct filled

type LocationApiController

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

LocationApiController binds http requests to an api service and writes the service results to the http response

func (*LocationApiController) GetSubIdLocation

func (c *LocationApiController) GetSubIdLocation(w http.ResponseWriter, r *http.Request)

GetSubIdLocation - Get last reported location

func (*LocationApiController) Routes

func (c *LocationApiController) Routes() Routes

Routes returns all of the api route for the LocationApiController

type LocationApiOption

type LocationApiOption func(*LocationApiController)

LocationApiOption for how the controller is set up.

func WithLocationApiErrorHandler

func WithLocationApiErrorHandler(h ErrorHandler) LocationApiOption

WithLocationApiErrorHandler inject ErrorHandler into controller

type LocationApiRouter

type LocationApiRouter interface {
	GetSubIdLocation(http.ResponseWriter, *http.Request)
}

LocationApiRouter defines the required methods for binding the api requests to a responses for the LocationApi The LocationApiRouter implementation should parse necessary information from the http request, pass the data to a LocationApiServicer to perform the required actions, then write the service results to the http response.

type LocationApiService

type LocationApiService struct {
}

LocationApiService is a service that implements the logic for the LocationApiServicer This service should implement the business logic for every endpoint for the LocationApi API. Include any external packages or services that will be required by this service.

func (*LocationApiService) GetSubIdLocation

func (s *LocationApiService) GetSubIdLocation(ctx context.Context, subId string) (ImplResponse, error)

GetSubIdLocation - Get last reported location

type LocationApiServicer

type LocationApiServicer interface {
	GetSubIdLocation(context.Context, string) (ImplResponse, error)
}

LocationApiServicer defines the api actions for the LocationApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewLocationApiService

func NewLocationApiService() LocationApiServicer

NewLocationApiService creates a default api service

type LocationDetails

type LocationDetails struct {
	AgeOfLocationInfo string `json:"ageOfLocationInfo,omitempty"`

	TrackingAreaId string `json:"trackingAreaId,omitempty"`

	PlmnId string `json:"plmnId,omitempty"`

	Lat string `json:"lat,omitempty"`

	Long string `json:"long,omitempty"`

	Elev string `json:"elev,omitempty"`
}

type LocationResponse

type LocationResponse struct {
	EventTime time.Time `json:"eventTime,omitempty"`

	Id string `json:"id,omitempty"`

	LocationInfo LocationDetails `json:"locationInfo,omitempty"`
}

type ParsingError

type ParsingError struct {
	Err error
}

ParsingError indicates that an error has occurred when parsing request parameters

func (*ParsingError) Error

func (e *ParsingError) Error() string

func (*ParsingError) Unwrap

func (e *ParsingError) Unwrap() error

type RecordCRUDApiController

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

RecordCRUDApiController binds http requests to an api service and writes the service results to the http response

func (*RecordCRUDApiController) DeleteCorrelation

func (c *RecordCRUDApiController) DeleteCorrelation(w http.ResponseWriter, r *http.Request)

DeleteCorrelation - Delete a Record with an user provided RecordId

func (*RecordCRUDApiController) Routes

func (c *RecordCRUDApiController) Routes() Routes

Routes returns all of the api route for the RecordCRUDApiController

type RecordCRUDApiOption

type RecordCRUDApiOption func(*RecordCRUDApiController)

RecordCRUDApiOption for how the controller is set up.

func WithRecordCRUDApiErrorHandler

func WithRecordCRUDApiErrorHandler(h ErrorHandler) RecordCRUDApiOption

WithRecordCRUDApiErrorHandler inject ErrorHandler into controller

type RecordCRUDApiRouter

type RecordCRUDApiRouter interface {
	DeleteCorrelation(http.ResponseWriter, *http.Request)
}

RecordCRUDApiRouter defines the required methods for binding the api requests to a responses for the RecordCRUDApi The RecordCRUDApiRouter implementation should parse necessary information from the http request, pass the data to a RecordCRUDApiServicer to perform the required actions, then write the service results to the http response.

type RecordCRUDApiService

type RecordCRUDApiService struct {
}

RecordCRUDApiService is a service that implements the logic for the RecordCRUDApiServicer This service should implement the business logic for every endpoint for the RecordCRUDApi API. Include any external packages or services that will be required by this service.

func (*RecordCRUDApiService) DeleteCorrelation

func (s *RecordCRUDApiService) DeleteCorrelation(ctx context.Context, ueId string, subIds []string) (ImplResponse, error)

DeleteCorrelation - Delete a Record with an user provided RecordId

type RecordCRUDApiServicer

type RecordCRUDApiServicer interface {
	DeleteCorrelation(context.Context, string, []string) (ImplResponse, error)
}

RecordCRUDApiServicer defines the api actions for the RecordCRUDApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewRecordCRUDApiService

func NewRecordCRUDApiService() RecordCRUDApiServicer

NewRecordCRUDApiService creates a default api service

type RequiredError

type RequiredError struct {
	Field string
}

RequiredError indicates that an error has occurred when parsing request parameters

func (*RequiredError) Error

func (e *RequiredError) Error() string

type Route

type Route struct {
	Name        string
	Method      string
	Pattern     string
	HandlerFunc http.HandlerFunc
}

A Route defines the parameters for an api endpoint

type Router

type Router interface {
	Routes() Routes
}

Router defines the required methods for retrieving api routes

func NewLocationApiController

func NewLocationApiController(s LocationApiServicer, opts ...LocationApiOption) Router

NewLocationApiController creates a default api controller

func NewRecordCRUDApiController

func NewRecordCRUDApiController(s RecordCRUDApiServicer, opts ...RecordCRUDApiOption) Router

NewRecordCRUDApiController creates a default api controller

func NewSubscriberApiController

func NewSubscriberApiController(s SubscriberApiServicer, opts ...SubscriberApiOption) Router

NewSubscriberApiController creates a default api controller

func NewUeIdCRUDApiController

func NewUeIdCRUDApiController(s UeIdCRUDApiServicer, opts ...UeIdCRUDApiOption) Router

NewUeIdCRUDApiController creates a default api controller

type Routes

type Routes []Route

Routes are a collection of defined api endpoints

type SubIds

type SubIds struct {
	SubIds []string `json:"subIds"`
}

type SubscriberApiController

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

SubscriberApiController binds http requests to an api service and writes the service results to the http response

func (*SubscriberApiController) GetSubIdLocation

func (c *SubscriberApiController) GetSubIdLocation(w http.ResponseWriter, r *http.Request)

GetSubIdLocation - Get last reported location

func (*SubscriberApiController) Routes

func (c *SubscriberApiController) Routes() Routes

Routes returns all of the api route for the SubscriberApiController

type SubscriberApiOption

type SubscriberApiOption func(*SubscriberApiController)

SubscriberApiOption for how the controller is set up.

func WithSubscriberApiErrorHandler

func WithSubscriberApiErrorHandler(h ErrorHandler) SubscriberApiOption

WithSubscriberApiErrorHandler inject ErrorHandler into controller

type SubscriberApiRouter

type SubscriberApiRouter interface {
	GetSubIdLocation(http.ResponseWriter, *http.Request)
}

SubscriberApiRouter defines the required methods for binding the api requests to a responses for the SubscriberApi The SubscriberApiRouter implementation should parse necessary information from the http request, pass the data to a SubscriberApiServicer to perform the required actions, then write the service results to the http response.

type SubscriberApiService

type SubscriberApiService struct {
}

SubscriberApiService is a service that implements the logic for the SubscriberApiServicer This service should implement the business logic for every endpoint for the SubscriberApi API. Include any external packages or services that will be required by this service.

func (*SubscriberApiService) GetSubIdLocation

func (s *SubscriberApiService) GetSubIdLocation(ctx context.Context, subId string) (ImplResponse, error)

GetSubIdLocation - Get last reported location

type SubscriberApiServicer

type SubscriberApiServicer interface {
	GetSubIdLocation(context.Context, string) (ImplResponse, error)
}

SubscriberApiServicer defines the api actions for the SubscriberApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewSubscriberApiService

func NewSubscriberApiService() SubscriberApiServicer

NewSubscriberApiService creates a default api service

type UeIdCRUDApiController

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

UeIdCRUDApiController binds http requests to an api service and writes the service results to the http response

func (*UeIdCRUDApiController) CreateOrModifyCorrelation

func (c *UeIdCRUDApiController) CreateOrModifyCorrelation(w http.ResponseWriter, r *http.Request)

CreateOrModifyCorrelation - Create/Modify correlation between ueId and subIDs

func (*UeIdCRUDApiController) Routes

func (c *UeIdCRUDApiController) Routes() Routes

Routes returns all of the api route for the UeIdCRUDApiController

type UeIdCRUDApiOption

type UeIdCRUDApiOption func(*UeIdCRUDApiController)

UeIdCRUDApiOption for how the controller is set up.

func WithUeIdCRUDApiErrorHandler

func WithUeIdCRUDApiErrorHandler(h ErrorHandler) UeIdCRUDApiOption

WithUeIdCRUDApiErrorHandler inject ErrorHandler into controller

type UeIdCRUDApiRouter

type UeIdCRUDApiRouter interface {
	CreateOrModifyCorrelation(http.ResponseWriter, *http.Request)
}

UeIdCRUDApiRouter defines the required methods for binding the api requests to a responses for the UeIdCRUDApi The UeIdCRUDApiRouter implementation should parse necessary information from the http request, pass the data to a UeIdCRUDApiServicer to perform the required actions, then write the service results to the http response.

type UeIdCRUDApiService

type UeIdCRUDApiService struct {
}

UeIdCRUDApiService is a service that implements the logic for the UeIdCRUDApiServicer This service should implement the business logic for every endpoint for the UeIdCRUDApi API. Include any external packages or services that will be required by this service.

func (*UeIdCRUDApiService) CreateOrModifyCorrelation

func (s *UeIdCRUDApiService) CreateOrModifyCorrelation(ctx context.Context, ueId string, subIds SubIds) (ImplResponse, error)

CreateOrModifyCorrelation - Create/Modify correlation between ueId and subIDs

type UeIdCRUDApiServicer

type UeIdCRUDApiServicer interface {
	CreateOrModifyCorrelation(context.Context, string, SubIds) (ImplResponse, error)
}

UeIdCRUDApiServicer defines the api actions for the UeIdCRUDApi service This interface intended to stay up to date with the openapi yaml used to generate it, while the service implementation can ignored with the .openapi-generator-ignore file and updated with the logic required for the API.

func NewUeIdCRUDApiService

func NewUeIdCRUDApiService() UeIdCRUDApiServicer

NewUeIdCRUDApiService creates a default api service

Jump to

Keyboard shortcuts

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