Documentation ¶
Index ¶
- Constants
- Variables
- func AddDeviceToMulticastGroup(ctx context.Context, db sqlx.Ext, multicastGroupID uuid.UUID, ...) error
- func CreateApplication(ctx context.Context, db sqlx.Queryer, item *Application) error
- func CreateBoard(db sqlx.Execer, bd *Board) error
- func CreateDevice(ctx context.Context, db sqlx.Ext, d *Device) error
- func CreateDeviceActivation(ctx context.Context, db sqlx.Queryer, da *DeviceActivation) error
- func CreateDeviceKeys(ctx context.Context, db sqlx.Execer, dc *DeviceKeys) error
- func CreateDeviceProfile(ctx context.Context, db sqlx.Ext, dp *DeviceProfile) error
- func CreateFUOTADeploymentForDevice(ctx context.Context, db sqlx.Ext, fd *FUOTADeployment, devEUI lorawan.EUI64) error
- func CreateGateway(ctx context.Context, db sqlx.Execer, gw *Gateway) error
- func CreateGatewayPing(ctx context.Context, db sqlx.Queryer, ping *GatewayPing) error
- func CreateGatewayPingRX(ctx context.Context, db sqlx.Queryer, rx *GatewayPingRX) error
- func CreateGatewayProfile(ctx context.Context, db sqlx.Ext, gp *GatewayProfile) error
- func CreateIntegration(ctx context.Context, db sqlx.Queryer, i *Integration) error
- func CreateMulticastGroup(ctx context.Context, db sqlx.Ext, mg *MulticastGroup) error
- func CreateNetworkServer(ctx context.Context, db sqlx.Queryer, n *NetworkServer) error
- func CreateOrganization(ctx context.Context, db sqlx.Queryer, org *Organization) error
- func CreateOrganizationUser(ctx context.Context, db sqlx.Execer, organizationID, userID int64, ...) error
- func CreateRemoteFragmentationSession(ctx context.Context, db sqlx.Ext, sess *RemoteFragmentationSession) error
- func CreateRemoteMulticastClassCSession(ctx context.Context, db sqlx.Ext, sess *RemoteMulticastClassCSession) error
- func CreateRemoteMulticastSetup(ctx context.Context, db sqlx.Ext, dms *RemoteMulticastSetup) error
- func CreateServiceProfile(ctx context.Context, db sqlx.Ext, sp *ServiceProfile) error
- func CreateUser(ctx context.Context, db sqlx.Queryer, user *User, password string) (int64, error)
- func DeleteAllApplicationsForOrganizationID(ctx context.Context, db sqlx.Ext, organizationID int64) error
- func DeleteAllDeviceProfilesForOrganizationID(ctx context.Context, db sqlx.Ext, organizationID int64) error
- func DeleteAllDevicesForApplicationID(ctx context.Context, db sqlx.Ext, applicationID int64) error
- func DeleteAllGatewaysForOrganizationID(ctx context.Context, db sqlx.Ext, organizationID int64) error
- func DeleteAllServiceProfilesForOrganizationID(ctx context.Context, db sqlx.Ext, organizationID int64) error
- func DeleteApplication(ctx context.Context, db sqlx.Ext, id int64) error
- func DeleteDevice(ctx context.Context, db sqlx.Ext, devEUI lorawan.EUI64) error
- func DeleteDeviceKeys(ctx context.Context, db sqlx.Execer, devEUI lorawan.EUI64) error
- func DeleteDeviceProfile(ctx context.Context, db sqlx.Ext, id uuid.UUID) error
- func DeleteGateway(ctx context.Context, db sqlx.Ext, mac lorawan.EUI64) error
- func DeleteGatewayProfile(ctx context.Context, db sqlx.Ext, id uuid.UUID) error
- func DeleteIntegration(ctx context.Context, db sqlx.Execer, id int64) error
- func DeleteMulticastGroup(ctx context.Context, db sqlx.Ext, id uuid.UUID) error
- func DeleteNetworkServer(ctx context.Context, db sqlx.Ext, id int64) error
- func DeleteOrganization(ctx context.Context, db sqlx.Ext, id int64) error
- func DeleteOrganizationUser(ctx context.Context, db sqlx.Execer, organizationID, userID int64) error
- func DeleteRemoteFragmentationSession(ctx context.Context, db sqlx.Execer, devEUI lorawan.EUI64, fragIndex int) error
- func DeleteRemoteMulticastClassCSession(ctx context.Context, db sqlx.Ext, devEUI lorawan.EUI64, ...) error
- func DeleteRemoteMulticastSetup(ctx context.Context, db sqlx.Ext, devEUI lorawan.EUI64, ...) error
- func DeleteServiceProfile(ctx context.Context, db sqlx.Ext, id uuid.UUID) error
- func DeleteUser(ctx context.Context, db sqlx.Execer, id int64) error
- func FinishRegistration(db sqlx.Execer, userID int64, newPwd string) error
- func GetAllDeviceEuis(ctx context.Context, db sqlx.Queryer) ([]string, error)
- func GetApplicationCount(ctx context.Context, db sqlx.Queryer, search string) (int, error)
- func GetApplicationCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, search string) (int, error)
- func GetApplicationCountForUser(ctx context.Context, db sqlx.Queryer, username string, organizationID int64, ...) (int, error)
- func GetDeviceCount(ctx context.Context, db sqlx.Queryer, filters DeviceFilters) (int, error)
- func GetDeviceCountForMulticastGroup(ctx context.Context, db sqlx.Queryer, multicastGroup uuid.UUID) (int, error)
- func GetDeviceProfileCount(ctx context.Context, db sqlx.Queryer) (int, error)
- func GetDeviceProfileCountForApplicationID(ctx context.Context, db sqlx.Queryer, applicationID int64) (int, error)
- func GetDeviceProfileCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64) (int, error)
- func GetDeviceProfileCountForUser(ctx context.Context, db sqlx.Queryer, username string) (int, error)
- func GetFUOTADeploymentCount(ctx context.Context, db sqlx.Queryer, filters FUOTADeploymentFilters) (int, error)
- func GetFUOTADeploymentDeviceCount(ctx context.Context, db sqlx.Queryer, fuotaDeploymentID uuid.UUID) (int, error)
- func GetGatewayCount(ctx context.Context, db sqlx.Queryer, search string) (int, error)
- func GetGatewayCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, search string) (int, error)
- func GetGatewayCountForUser(ctx context.Context, db sqlx.Queryer, username string, search string) (int, error)
- func GetGatewayProfileCount(ctx context.Context, db sqlx.Queryer) (int, error)
- func GetGatewayProfileCountForNetworkServerID(ctx context.Context, db sqlx.Queryer, networkServerID int64) (int, error)
- func GetGatewaysForMACs(ctx context.Context, db sqlx.Queryer, macs []lorawan.EUI64) (map[lorawan.EUI64]Gateway, error)
- func GetLastGatewayPingAndRX(ctx context.Context, db sqlx.Queryer, mac lorawan.EUI64) (GatewayPing, []GatewayPingRX, error)
- func GetMulticastGroupCount(ctx context.Context, db sqlx.Queryer, filters MulticastGroupFilters) (int, error)
- func GetNetworkServerCount(ctx context.Context, db sqlx.Queryer) (int, error)
- func GetNetworkServerCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64) (int, error)
- func GetOrganizationCount(ctx context.Context, db sqlx.Queryer, search string) (int, error)
- func GetOrganizationCountForUser(ctx context.Context, db sqlx.Queryer, username string, search string) (int, error)
- func GetOrganizationUserCount(ctx context.Context, db sqlx.Queryer, organizationID int64) (int, error)
- func GetServiceProfileCount(ctx context.Context, db sqlx.Queryer) (int, error)
- func GetServiceProfileCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64) (int, error)
- func GetServiceProfileCountForUser(ctx context.Context, db sqlx.Queryer, username string) (int, error)
- func GetServiceProfileIDForFUOTADeployment(ctx context.Context, db sqlx.Ext, fuotaDeploymentID uuid.UUID) (uuid.UUID, error)
- func GetUserCount(ctx context.Context, db sqlx.Queryer, search string) (int32, error)
- func LoginUser(ctx context.Context, db sqlx.Queryer, username string, password string) (string, error)
- func MakeJWT(username string, sessionTTL int32) (string, error)
- func RedisPool() *redis.Pool
- func RegisterBoardAtomic(db sqlx.Execer, bd *Board) error
- func RegisterUser(db sqlx.Queryer, user *User, token string) error
- func RemoveDeviceFromMulticastGroup(ctx context.Context, db sqlx.Ext, multicastGroupID uuid.UUID, ...) error
- func SaveMetrics(ctx context.Context, p *redis.Pool, name string, metrics MetricsRecord) error
- func SaveMetricsForInterval(ctx context.Context, p *redis.Pool, agg AggregationInterval, name string, ...) error
- func SetAggregationIntervals(intervals []AggregationInterval) error
- func SetMetricsTTL(minute, hour, day, month time.Duration)
- func SetTimeLocation(name string) error
- func Setup(c config.Config) error
- func Transaction(f func(tx sqlx.Ext) error) error
- func UnregisterBoardAtomic(db sqlx.Execer, bd *Board) error
- func UpdateApplication(ctx context.Context, db sqlx.Execer, item Application) error
- func UpdateBoard(db sqlx.Execer, bd *Board) error
- func UpdateDevice(ctx context.Context, db sqlx.Ext, d *Device, localOnly bool) error
- func UpdateDeviceKeys(ctx context.Context, db sqlx.Execer, dc *DeviceKeys) error
- func UpdateDeviceProfile(ctx context.Context, db sqlx.Ext, dp *DeviceProfile) error
- func UpdateFUOTADeployment(ctx context.Context, db sqlx.Ext, fd *FUOTADeployment) error
- func UpdateFUOTADeploymentDevice(ctx context.Context, db sqlx.Ext, fdd *FUOTADeploymentDevice) error
- func UpdateGateway(ctx context.Context, db sqlx.Execer, gw *Gateway) error
- func UpdateGatewayProfile(ctx context.Context, db sqlx.Ext, gp *GatewayProfile) error
- func UpdateIntegration(ctx context.Context, db sqlx.Execer, i *Integration) error
- func UpdateMulticastGroup(ctx context.Context, db sqlx.Ext, mg *MulticastGroup) error
- func UpdateNetworkServer(ctx context.Context, db sqlx.Execer, n *NetworkServer) error
- func UpdateOrganization(ctx context.Context, db sqlx.Execer, org *Organization) error
- func UpdateOrganizationUser(ctx context.Context, db sqlx.Execer, organizationID, userID int64, ...) error
- func UpdatePassword(ctx context.Context, db sqlx.Execer, id int64, newpassword string) error
- func UpdateRemoteFragmentationSession(ctx context.Context, db sqlx.Ext, sess *RemoteFragmentationSession) error
- func UpdateRemoteMulticastClassCSession(ctx context.Context, db sqlx.Ext, sess *RemoteMulticastClassCSession) error
- func UpdateRemoteMulticastSetup(ctx context.Context, db sqlx.Ext, dmg *RemoteMulticastSetup) error
- func UpdateServiceProfile(ctx context.Context, db sqlx.Ext, sp *ServiceProfile) error
- func UpdateUser(ctx context.Context, db sqlx.Execer, item UserUpdate) error
- func ValidateEmail(email string) error
- func ValidatePassword(password string) error
- func ValidateUsername(username string) error
- type Action
- type AggregationInterval
- type Application
- type ApplicationListItem
- func GetApplications(ctx context.Context, db sqlx.Queryer, limit, offset int, search string) ([]ApplicationListItem, error)
- func GetApplicationsForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int, ...) ([]ApplicationListItem, error)
- func GetApplicationsForUser(ctx context.Context, db sqlx.Queryer, username string, organizationID int64, ...) ([]ApplicationListItem, error)
- type Board
- type DBLogger
- func (db *DBLogger) Beginx() (*TxLogger, error)
- func (db *DBLogger) Exec(query string, args ...interface{}) (sql.Result, error)
- func (db *DBLogger) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (db *DBLogger) QueryRowx(query string, args ...interface{}) *sqlx.Row
- func (db *DBLogger) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
- type Device
- type DeviceActivation
- type DeviceFilters
- type DeviceKeys
- type DeviceListItem
- type DeviceProfile
- type DeviceProfileMeta
- func GetDeviceProfiles(ctx context.Context, db sqlx.Queryer, limit, offset int) ([]DeviceProfileMeta, error)
- func GetDeviceProfilesForApplicationID(ctx context.Context, db sqlx.Queryer, applicationID int64, limit, offset int) ([]DeviceProfileMeta, error)
- func GetDeviceProfilesForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int) ([]DeviceProfileMeta, error)
- func GetDeviceProfilesForUser(ctx context.Context, db sqlx.Queryer, username string, limit, offset int) ([]DeviceProfileMeta, error)
- type ExtraChannel
- type FUOTADeployment
- type FUOTADeploymentDevice
- type FUOTADeploymentDeviceListItem
- type FUOTADeploymentDeviceState
- type FUOTADeploymentFilters
- type FUOTADeploymentGroupType
- type FUOTADeploymentListItem
- type FUOTADeploymentState
- type GPSPoint
- type Gateway
- func GetGateway(ctx context.Context, db sqlx.Queryer, mac lorawan.EUI64, forUpdate bool) (Gateway, error)
- func GetGateways(ctx context.Context, db sqlx.Queryer, limit, offset int, search string) ([]Gateway, error)
- func GetGatewaysForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int, ...) ([]Gateway, error)
- func GetGatewaysForUser(ctx context.Context, db sqlx.Queryer, username string, limit, offset int, ...) ([]Gateway, error)
- type GatewayLocation
- type GatewayPing
- type GatewayPingRX
- type GatewayProfile
- type GatewayProfileMeta
- type Integration
- func GetIntegration(ctx context.Context, db sqlx.Queryer, id int64) (Integration, error)
- func GetIntegrationByApplicationID(ctx context.Context, db sqlx.Queryer, applicationID int64, kind string) (Integration, error)
- func GetIntegrationsForApplicationID(ctx context.Context, db sqlx.Queryer, applicationID int64) ([]Integration, error)
- type MetricsRecord
- type MulticastGroup
- type MulticastGroupFilters
- type MulticastGroupListItem
- type NetworkServer
- func GetNetworkServer(ctx context.Context, db sqlx.Queryer, id int64) (NetworkServer, error)
- func GetNetworkServerForDevEUI(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64) (NetworkServer, error)
- func GetNetworkServerForDeviceProfileID(ctx context.Context, db sqlx.Queryer, id uuid.UUID) (NetworkServer, error)
- func GetNetworkServerForGatewayMAC(ctx context.Context, db sqlx.Queryer, mac lorawan.EUI64) (NetworkServer, error)
- func GetNetworkServerForGatewayProfileID(ctx context.Context, db sqlx.Queryer, id uuid.UUID) (NetworkServer, error)
- func GetNetworkServerForMulticastGroupID(ctx context.Context, db sqlx.Queryer, id uuid.UUID) (NetworkServer, error)
- func GetNetworkServerForServiceProfileID(ctx context.Context, db sqlx.Queryer, id uuid.UUID) (NetworkServer, error)
- func GetNetworkServers(ctx context.Context, db sqlx.Queryer, limit, offset int) ([]NetworkServer, error)
- func GetNetworkServersForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int) ([]NetworkServer, error)
- type Organization
- func GetOrganization(ctx context.Context, db sqlx.Queryer, id int64) (Organization, error)
- func GetOrganizations(ctx context.Context, db sqlx.Queryer, limit, offset int, search string) ([]Organization, error)
- func GetOrganizationsForUser(ctx context.Context, db sqlx.Queryer, username string, limit, offset int, ...) ([]Organization, error)
- type OrganizationUser
- type RemoteFragmentationSession
- type RemoteMulticastClassCSession
- func GetPendingRemoteMulticastClassCSessions(ctx context.Context, db sqlx.Queryer, limit, maxRetryCount int) ([]RemoteMulticastClassCSession, error)
- func GetRemoteMulticastClassCSession(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64, ...) (RemoteMulticastClassCSession, error)
- func GetRemoteMulticastClassCSessionByGroupID(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64, mcGroupID int, ...) (RemoteMulticastClassCSession, error)
- type RemoteMulticastSetup
- func GetPendingRemoteMulticastSetupItems(ctx context.Context, db sqlx.Queryer, limit, maxRetryCount int) ([]RemoteMulticastSetup, error)
- func GetRemoteMulticastSetup(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64, ...) (RemoteMulticastSetup, error)
- func GetRemoteMulticastSetupByGroupID(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64, mcGroupID int, ...) (RemoteMulticastSetup, error)
- type RemoteMulticastSetupState
- type SearchResult
- type ServiceProfile
- type ServiceProfileMeta
- func GetServiceProfiles(ctx context.Context, db sqlx.Queryer, limit, offset int) ([]ServiceProfileMeta, error)
- func GetServiceProfilesForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int) ([]ServiceProfileMeta, error)
- func GetServiceProfilesForUser(ctx context.Context, db sqlx.Queryer, username string, limit, offset int) ([]ServiceProfileMeta, error)
- type TxLogger
- func (q *TxLogger) Exec(query string, args ...interface{}) (sql.Result, error)
- func (q *TxLogger) Query(query string, args ...interface{}) (*sql.Rows, error)
- func (q *TxLogger) QueryRowx(query string, args ...interface{}) *sqlx.Row
- func (q *TxLogger) Queryx(query string, args ...interface{}) (*sqlx.Rows, error)
- type User
- func GetTokenByUsername(db sqlx.Queryer, username string) (User, error)
- func GetUser(ctx context.Context, db sqlx.Queryer, id int64) (User, error)
- func GetUserByToken(db sqlx.Queryer, token string) (User, error)
- func GetUserByUsername(ctx context.Context, db sqlx.Queryer, username string) (User, error)
- func GetUsers(ctx context.Context, db sqlx.Queryer, limit, offset int, search string) ([]User, error)
- type UserProfile
- type UserProfileOrganization
- type UserProfileUser
- type UserUpdate
Constants ¶
const ( ModulationFSK = "FSK" ModulationLoRa = "LORA" )
Modulations
Variables ¶
var ( ErrAlreadyExists = errors.New("object already exists") ErrDoesNotExist = errors.New("object does not exist") ErrUsedByOtherObjects = errors.New("this object is used by other objects, remove them first") ErrApplicationInvalidName = errors.New("invalid application name") ErrNodeInvalidName = errors.New("invalid node name") ErrNodeMaxRXDelay = errors.New("max value of RXDelay is 15") ErrCFListTooManyChannels = errors.New("too many channels in channel-list") ErrUserInvalidUsername = errors.New("username name may only be composed of upper and lower case characters and digits") ErrUserPasswordLength = errors.New("passwords must be at least 6 characters long") ErrInvalidUsernameOrPassword = errors.New("invalid username or password") ErrOrganizationInvalidName = errors.New("invalid organization name") ErrGatewayInvalidName = errors.New("invalid gateway name") ErrInvalidEmail = errors.New("invalid e-mail") ErrInvalidGatewayDiscoveryInterval = errors.New("invalid gateway-discovery interval, it must be greater than 0") ErrDeviceProfileInvalidName = errors.New("invalid device-profile name") ErrBoardInvalidServer = errors.New("invalid hostname of the server") )
errors
var ( HashIterations = 100000 DemoUser = "" )
Functions ¶
func AddDeviceToMulticastGroup ¶
func AddDeviceToMulticastGroup(ctx context.Context, db sqlx.Ext, multicastGroupID uuid.UUID, devEUI lorawan.EUI64) error
AddDeviceToMulticastGroup adds the given device to the given multicast-group. It is recommended that db is a transaction.
func CreateApplication ¶
CreateApplication creates the given Application.
func CreateBoard ¶
CreateBoard creates the given board.
func CreateDevice ¶
CreateDevice creates the given device.
func CreateDeviceActivation ¶
CreateDeviceActivation creates the given device-activation.
func CreateDeviceKeys ¶
CreateDeviceKeys creates the keys for the given device.
func CreateDeviceProfile ¶
CreateDeviceProfile creates the given device-profile. This will create the device-profile at the network-server side and will create a local reference record.
func CreateFUOTADeploymentForDevice ¶
func CreateFUOTADeploymentForDevice(ctx context.Context, db sqlx.Ext, fd *FUOTADeployment, devEUI lorawan.EUI64) error
CreateFUOTADeploymentForDevice creates and initializes a FUOTA deployment for the given device.
func CreateGateway ¶
CreateGateway creates the given Gateway.
func CreateGatewayPing ¶
CreateGatewayPing creates the given gateway ping.
func CreateGatewayPingRX ¶
CreateGatewayPingRX creates the received ping.
func CreateGatewayProfile ¶
CreateGatewayProfile creates the given gateway-profile. This will create the gateway-profile at the network-server side and will create a local reference record.
func CreateIntegration ¶
CreateIntegration creates the given Integration.
func CreateMulticastGroup ¶
CreateMulticastGroup creates the given multicast-group.
func CreateNetworkServer ¶
CreateNetworkServer creates the given network-server.
func CreateOrganization ¶
CreateOrganization creates the given Organization.
func CreateOrganizationUser ¶
func CreateOrganizationUser(ctx context.Context, db sqlx.Execer, organizationID, userID int64, isAdmin, isDeviceAdmin, isGatewayAdmin bool) error
CreateOrganizationUser adds the given user to the organization.
func CreateRemoteFragmentationSession ¶
func CreateRemoteFragmentationSession(ctx context.Context, db sqlx.Ext, sess *RemoteFragmentationSession) error
CreateRemoteFragmentationSession creates the given fragmentation session.
func CreateRemoteMulticastClassCSession ¶
func CreateRemoteMulticastClassCSession(ctx context.Context, db sqlx.Ext, sess *RemoteMulticastClassCSession) error
CreateRemoteMulticastClassCSession creates the given multicast Class-C session.
func CreateRemoteMulticastSetup ¶
CreateRemoteMulticastSetup creates the given multicast-setup.
func CreateServiceProfile ¶
CreateServiceProfile creates the given service-profile.
func CreateUser ¶
CreateUser creates the given user.
func DeleteAllApplicationsForOrganizationID ¶
func DeleteAllApplicationsForOrganizationID(ctx context.Context, db sqlx.Ext, organizationID int64) error
DeleteAllApplicationsForOrganizationID deletes all applications given an organization id.
func DeleteAllDeviceProfilesForOrganizationID ¶
func DeleteAllDeviceProfilesForOrganizationID(ctx context.Context, db sqlx.Ext, organizationID int64) error
DeleteAllDeviceProfilesForOrganizationID deletes all device-profiles given an organization id.
func DeleteAllDevicesForApplicationID ¶
DeleteAllDevicesForApplicationID deletes all devices given an application id.
func DeleteAllGatewaysForOrganizationID ¶
func DeleteAllGatewaysForOrganizationID(ctx context.Context, db sqlx.Ext, organizationID int64) error
DeleteAllGatewaysForOrganizationID deletes all gateways for a given organization id.
func DeleteAllServiceProfilesForOrganizationID ¶
func DeleteAllServiceProfilesForOrganizationID(ctx context.Context, db sqlx.Ext, organizationID int64) error
DeleteAllServiceProfilesForOrganizationID deletes all service-profiles given an organization id.
func DeleteApplication ¶
DeleteApplication deletes the Application matching the given ID.
func DeleteDevice ¶
DeleteDevice deletes the device matching the given DevEUI.
func DeleteDeviceKeys ¶
DeleteDeviceKeys deletes the device-keys for the given DevEUI.
func DeleteDeviceProfile ¶
DeleteDeviceProfile deletes the device-profile matching the given id.
func DeleteGateway ¶
DeleteGateway deletes the gateway matching the given MAC.
func DeleteGatewayProfile ¶
DeleteGatewayProfile deletes the gateway-profile matching the given id.
func DeleteIntegration ¶
DeleteIntegration deletes the integration matching the given id.
func DeleteMulticastGroup ¶
DeleteMulticastGroup deletes a multicast-group given an id.
func DeleteNetworkServer ¶
DeleteNetworkServer deletes the network-server matching the given id.
func DeleteOrganization ¶
DeleteOrganization deletes the organization matching the given id.
func DeleteOrganizationUser ¶
func DeleteOrganizationUser(ctx context.Context, db sqlx.Execer, organizationID, userID int64) error
DeleteOrganizationUser deletes the given organization user.
func DeleteRemoteFragmentationSession ¶
func DeleteRemoteFragmentationSession(ctx context.Context, db sqlx.Execer, devEUI lorawan.EUI64, fragIndex int) error
DeleteRemoteFragmentationSession removes the fragmentation session for the given DevEUI / fragmentation index combination.
func DeleteRemoteMulticastClassCSession ¶
func DeleteRemoteMulticastClassCSession(ctx context.Context, db sqlx.Ext, devEUI lorawan.EUI64, multicastGroupID uuid.UUID) error
DeleteRemoteMulticastClassCSession deletes the multicast Class-C session given a DevEUI and multicast-group ID.
func DeleteRemoteMulticastSetup ¶
func DeleteRemoteMulticastSetup(ctx context.Context, db sqlx.Ext, devEUI lorawan.EUI64, multicastGroupID uuid.UUID) error
DeleteRemoteMulticastSetup deletes the multicast-setup given a multicast-group ID and DevEUI.
func DeleteServiceProfile ¶
DeleteServiceProfile deletes the service-profile matching the given id.
func DeleteUser ¶
DeleteUser deletes the User record matching the given ID.
func FinishRegistration ¶
FinishRegistration ...
func GetAllDeviceEuis ¶
GetDevices returns a slice of devices.
func GetApplicationCount ¶
GetApplicationCount returns the total number of applications.
func GetApplicationCountForOrganizationID ¶
func GetApplicationCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, search string) (int, error)
GetApplicationCountForOrganizationID returns the total number of applications for the given organization.
func GetApplicationCountForUser ¶
func GetApplicationCountForUser(ctx context.Context, db sqlx.Queryer, username string, organizationID int64, search string) (int, error)
GetApplicationCountForUser returns the total number of applications available for the given user. When an organizationID is given, the results will be filtered by this organization ID.
func GetDeviceCount ¶
GetDeviceCount returns the number of devices.
func GetDeviceCountForMulticastGroup ¶
func GetDeviceCountForMulticastGroup(ctx context.Context, db sqlx.Queryer, multicastGroup uuid.UUID) (int, error)
GetDeviceCountForMulticastGroup returns the number of devices for the given multicast-group.
func GetDeviceProfileCount ¶
GetDeviceProfileCount returns the total number of device-profiles.
func GetDeviceProfileCountForApplicationID ¶
func GetDeviceProfileCountForApplicationID(ctx context.Context, db sqlx.Queryer, applicationID int64) (int, error)
GetDeviceProfileCountForApplicationID returns the total number of device-profiles that can be used for the given application id (based on the service-profile of the application).
func GetDeviceProfileCountForOrganizationID ¶
func GetDeviceProfileCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64) (int, error)
GetDeviceProfileCountForOrganizationID returns the total number of device-profiles for the given organization id.
func GetDeviceProfileCountForUser ¶
func GetDeviceProfileCountForUser(ctx context.Context, db sqlx.Queryer, username string) (int, error)
GetDeviceProfileCountForUser returns the total number of device-profiles for the given username.
func GetFUOTADeploymentCount ¶
func GetFUOTADeploymentCount(ctx context.Context, db sqlx.Queryer, filters FUOTADeploymentFilters) (int, error)
GetFUOTADeploymentCount returns the number of FUOTA deployments.
func GetFUOTADeploymentDeviceCount ¶
func GetFUOTADeploymentDeviceCount(ctx context.Context, db sqlx.Queryer, fuotaDeploymentID uuid.UUID) (int, error)
GetFUOTADeploymentDeviceCount returns the device count for the given FUOTA deployment ID.
func GetGatewayCount ¶
GetGatewayCount returns the total number of gateways.
func GetGatewayCountForOrganizationID ¶
func GetGatewayCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, search string) (int, error)
GetGatewayCountForOrganizationID returns the total number of gateways given an organization ID.
func GetGatewayCountForUser ¶
func GetGatewayCountForUser(ctx context.Context, db sqlx.Queryer, username string, search string) (int, error)
GetGatewayCountForUser returns the total number of gateways to which the given user has access.
func GetGatewayProfileCount ¶
GetGatewayProfileCount returns the total number of gateway-profiles.
func GetGatewayProfileCountForNetworkServerID ¶
func GetGatewayProfileCountForNetworkServerID(ctx context.Context, db sqlx.Queryer, networkServerID int64) (int, error)
GetGatewayProfileCountForNetworkServerID returns the total number of gateway-profiles given a network-server ID.
func GetGatewaysForMACs ¶
func GetGatewaysForMACs(ctx context.Context, db sqlx.Queryer, macs []lorawan.EUI64) (map[lorawan.EUI64]Gateway, error)
GetGatewaysForMACs returns a map of gateways given a slice of MACs.
func GetLastGatewayPingAndRX ¶
func GetLastGatewayPingAndRX(ctx context.Context, db sqlx.Queryer, mac lorawan.EUI64) (GatewayPing, []GatewayPingRX, error)
GetLastGatewayPingAndRX returns the last gateway ping and RX for the given gateway MAC.
func GetMulticastGroupCount ¶
func GetMulticastGroupCount(ctx context.Context, db sqlx.Queryer, filters MulticastGroupFilters) (int, error)
GetMulticastGroupCount returns the total number of multicast-groups given the provided filters. Note that empty values are not used as filters.
func GetNetworkServerCount ¶
GetNetworkServerCount returns the total number of network-servers.
func GetNetworkServerCountForOrganizationID ¶
func GetNetworkServerCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64) (int, error)
GetNetworkServerCountForOrganizationID returns the total number of network-servers accessible for the given organization id. A network-server is accessible for an organization when it is used by one of its service-profiles.
func GetOrganizationCount ¶
GetOrganizationCount returns the total number of organizations.
func GetOrganizationCountForUser ¶
func GetOrganizationCountForUser(ctx context.Context, db sqlx.Queryer, username string, search string) (int, error)
GetOrganizationCountForUser returns the number of organizations to which the given user is member of.
func GetOrganizationUserCount ¶
func GetOrganizationUserCount(ctx context.Context, db sqlx.Queryer, organizationID int64) (int, error)
GetOrganizationUserCount returns the number of users for the given organization.
func GetServiceProfileCount ¶
GetServiceProfileCount returns the total number of service-profiles.
func GetServiceProfileCountForOrganizationID ¶
func GetServiceProfileCountForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64) (int, error)
GetServiceProfileCountForOrganizationID returns the total number of service-profiles for the given organization id.
func GetServiceProfileCountForUser ¶
func GetServiceProfileCountForUser(ctx context.Context, db sqlx.Queryer, username string) (int, error)
GetServiceProfileCountForUser returns the total number of service-profiles for the given username.
func GetServiceProfileIDForFUOTADeployment ¶
func GetServiceProfileIDForFUOTADeployment(ctx context.Context, db sqlx.Ext, fuotaDeploymentID uuid.UUID) (uuid.UUID, error)
GetServiceProfileIDForFUOTADeployment returns the service-profile ID for the given FUOTA deployment.
func GetUserCount ¶
GetUserCount returns the total number of users.
func LoginUser ¶
func LoginUser(ctx context.Context, db sqlx.Queryer, username string, password string) (string, error)
LoginUser returns a JWT token for the user matching the given username and password.
func RegisterBoardAtomic ¶
RegisterBoardAtomic updates "server" field atomically.
func RegisterUser ¶
RegisterUser ...
func RemoveDeviceFromMulticastGroup ¶
func RemoveDeviceFromMulticastGroup(ctx context.Context, db sqlx.Ext, multicastGroupID uuid.UUID, devEUI lorawan.EUI64) error
RemoveDeviceFromMulticastGroup removes the given device from the given multicast-group.
func SaveMetrics ¶
SaveMetrics stores the given metrics into Redis.
func SaveMetricsForInterval ¶
func SaveMetricsForInterval(ctx context.Context, p *redis.Pool, agg AggregationInterval, name string, metrics MetricsRecord) error
SaveMetricsForInterval aggregates and stores the given metrics.
func SetAggregationIntervals ¶
func SetAggregationIntervals(intervals []AggregationInterval) error
SetAggregationIntervals sets the metrics aggregation to the given intervals.
func SetMetricsTTL ¶
SetMetricsTTL sets the storage TTL.
func SetTimeLocation ¶
SetTimeLocation sets the time location.
func Transaction ¶
Transaction wraps the given function in a transaction. In case the given functions returns an error, the transaction will be rolled back.
func UnregisterBoardAtomic ¶
UnregisterBoardAtomic ...
func UpdateApplication ¶
UpdateApplication updates the given Application.
func UpdateBoard ¶
UpdateBoard updates the given board.
func UpdateDevice ¶
UpdateDevice updates the given device. When localOnly is set, it will not update the device on the network-server.
func UpdateDeviceKeys ¶
UpdateDeviceKeys updates the given device-keys.
func UpdateDeviceProfile ¶
UpdateDeviceProfile updates the given device-profile.
func UpdateFUOTADeployment ¶
UpdateFUOTADeployment updates the given FUOTA deployment.
func UpdateFUOTADeploymentDevice ¶
func UpdateFUOTADeploymentDevice(ctx context.Context, db sqlx.Ext, fdd *FUOTADeploymentDevice) error
UpdateFUOTADeploymentDevice updates the given fuota deployment device record.
func UpdateGateway ¶
UpdateGateway updates the given Gateway.
func UpdateGatewayProfile ¶
UpdateGatewayProfile updates the given gateway-profile.
func UpdateIntegration ¶
UpdateIntegration updates the given Integration.
func UpdateMulticastGroup ¶
UpdateMulticastGroup updates the given multicast-group.
func UpdateNetworkServer ¶
UpdateNetworkServer updates the given network-server.
func UpdateOrganization ¶
UpdateOrganization updates the given organization.
func UpdateOrganizationUser ¶
func UpdateOrganizationUser(ctx context.Context, db sqlx.Execer, organizationID, userID int64, isAdmin, isDeviceAdmin, isGatewayAdmin bool) error
UpdateOrganizationUser updates the given user of the organization.
func UpdatePassword ¶
UpdatePassword updates the user with the new password.
func UpdateRemoteFragmentationSession ¶
func UpdateRemoteFragmentationSession(ctx context.Context, db sqlx.Ext, sess *RemoteFragmentationSession) error
UpdateRemoteFragmentationSession updates the given fragmentation session.
func UpdateRemoteMulticastClassCSession ¶
func UpdateRemoteMulticastClassCSession(ctx context.Context, db sqlx.Ext, sess *RemoteMulticastClassCSession) error
UpdateRemoteMulticastClassCSession updates the given remote multicast Class-C session.
func UpdateRemoteMulticastSetup ¶
UpdateRemoteMulticastSetup updates the given update multicast-group setup.
func UpdateServiceProfile ¶
UpdateServiceProfile updates the given service-profile.
func UpdateUser ¶
UpdateUser updates the given User.
func ValidateEmail ¶
ValidateEmail validates the given e-mail.
func ValidatePassword ¶
ValidatePassword validates the given password.
func ValidateUsername ¶
ValidateUsername validates the given username.
Types ¶
type AggregationInterval ¶
type AggregationInterval string
AggregationInterval defines the aggregation type.
const ( AggregationMinute AggregationInterval = "MINUTE" AggregationHour AggregationInterval = "HOUR" AggregationDay AggregationInterval = "DAY" AggregationMonth AggregationInterval = "MONTH" )
Metrics aggregation intervals.
type Application ¶
type Application struct { ID int64 `db:"id"` Name string `db:"name"` Description string `db:"description"` OrganizationID int64 `db:"organization_id"` ServiceProfileID uuid.UUID `db:"service_profile_id"` PayloadCodec codec.Type `db:"payload_codec"` PayloadEncoderScript string `db:"payload_encoder_script"` PayloadDecoderScript string `db:"payload_decoder_script"` }
Application represents an application.
func GetApplication ¶
GetApplication returns the Application for the given id.
func (Application) Validate ¶
func (a Application) Validate() error
Validate validates the data of the Application.
type ApplicationListItem ¶
type ApplicationListItem struct { Application ServiceProfileName string `db:"service_profile_name"` }
ApplicationListItem devices the application as a list item.
func GetApplications ¶
func GetApplications(ctx context.Context, db sqlx.Queryer, limit, offset int, search string) ([]ApplicationListItem, error)
GetApplications returns a slice of applications, sorted by name and respecting the given limit and offset.
type Board ¶
type Board struct { MAC lorawan.EUI64 `db:"mac"` SN *string `db:"sn"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Model string `db:"model"` VpnAddr string `db:"vpn_addr"` QaErr int `db:"qa_err"` OsVersion *string `db:"os_version"` FPGAVersion *string `db:"fpga_version"` RootPassword *string `db:"root_password"` Server *string `db:"server"` }
Board represents a gateway.
func GetBoardMacBySerialNumber ¶
GetBoardMacBySerialNumber returns the board MAC for the serial number.
type DBLogger ¶
DBLogger is a DB wrapper which logs the executed sql queries and their duration.
type Device ¶
type Device struct { DevEUI lorawan.EUI64 `db:"dev_eui"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` LastSeenAt *time.Time `db:"last_seen_at"` ApplicationID int64 `db:"application_id"` DeviceProfileID uuid.UUID `db:"device_profile_id"` Name string `db:"name"` Description string `db:"description"` SkipFCntCheck bool `db:"-"` ReferenceAltitude float64 `db:"-"` DeviceStatusBattery *float32 `db:"device_status_battery"` DeviceStatusMargin *int `db:"device_status_margin"` DeviceStatusExternalPower bool `db:"device_status_external_power_source"` DR *int `db:"dr"` Latitude *float64 `db:"latitude"` Longitude *float64 `db:"longitude"` Altitude *float64 `db:"altitude"` Variables hstore.Hstore `db:"variables"` Tags hstore.Hstore `db:"tags"` }
Device defines a LoRaWAN device.
func GetDevice ¶
func GetDevice(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64, forUpdate, localOnly bool) (Device, error)
GetDevice returns the device matching the given DevEUI. When forUpdate is set to true, then db must be a db transaction. When localOnly is set to true, no call to the network-server is made to retrieve additional device data.
type DeviceActivation ¶
type DeviceActivation struct { ID int64 `db:"id"` CreatedAt time.Time `db:"created_at"` DevEUI lorawan.EUI64 `db:"dev_eui"` DevAddr lorawan.DevAddr `db:"dev_addr"` AppSKey lorawan.AES128Key `db:"app_s_key"` }
DeviceActivation defines the device-activation for a LoRaWAN device.
func GetLastDeviceActivationForDevEUI ¶
func GetLastDeviceActivationForDevEUI(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64) (DeviceActivation, error)
GetLastDeviceActivationForDevEUI returns the most recent device-activation for the given DevEUI.
type DeviceFilters ¶
type DeviceFilters struct { ApplicationID int64 `db:"application_id"` MulticastGroupID uuid.UUID `db:"multicast_group_id"` ServiceProfileID uuid.UUID `db:"service_profile_id"` Search string `db:"search"` // Limit and Offset are added for convenience so that this struct can // be given as the arguments. Limit int `db:"limit"` Offset int `db:"offset"` }
DeviceFilters provide filters that can be used to filter on devices. Note that empty values are not used as filter.
type DeviceKeys ¶
type DeviceKeys struct { CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` DevEUI lorawan.EUI64 `db:"dev_eui"` NwkKey lorawan.AES128Key `db:"nwk_key"` AppKey lorawan.AES128Key `db:"app_key"` GenAppKey lorawan.AES128Key `db:"gen_app_key"` JoinNonce int `db:"join_nonce"` }
DeviceKeys defines the keys for a LoRaWAN device.
func GetDeviceKeys ¶
GetDeviceKeys returns the device-keys for the given DevEUI.
type DeviceListItem ¶
DeviceListItem defines the Device as list item.
func GetDevices ¶
func GetDevices(ctx context.Context, db sqlx.Queryer, filters DeviceFilters) ([]DeviceListItem, error)
GetDevices returns a slice of devices.
type DeviceProfile ¶
type DeviceProfile struct { NetworkServerID int64 `db:"network_server_id"` OrganizationID int64 `db:"organization_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` PayloadCodec codec.Type `db:"payload_codec"` PayloadEncoderScript string `db:"payload_encoder_script"` PayloadDecoderScript string `db:"payload_decoder_script"` DeviceProfile ns.DeviceProfile `db:"-"` }
DeviceProfile defines the device-profile.
func GetDeviceProfile ¶
func GetDeviceProfile(ctx context.Context, db sqlx.Queryer, id uuid.UUID, forUpdate, localOnly bool) (DeviceProfile, error)
GetDeviceProfile returns the device-profile matching the given id. When forUpdate is set to true, then db must be a db transaction. When localOnly is set to true, no call to the network-server is made to retrieve additional device data.
func (DeviceProfile) Validate ¶
func (dp DeviceProfile) Validate() error
Validate validates the device-profile data.
type DeviceProfileMeta ¶
type DeviceProfileMeta struct { DeviceProfileID uuid.UUID `db:"device_profile_id"` NetworkServerID int64 `db:"network_server_id"` OrganizationID int64 `db:"organization_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` }
DeviceProfileMeta defines the device-profile meta record.
func GetDeviceProfiles ¶
func GetDeviceProfiles(ctx context.Context, db sqlx.Queryer, limit, offset int) ([]DeviceProfileMeta, error)
GetDeviceProfiles returns a slice of device-profiles.
func GetDeviceProfilesForApplicationID ¶
func GetDeviceProfilesForApplicationID(ctx context.Context, db sqlx.Queryer, applicationID int64, limit, offset int) ([]DeviceProfileMeta, error)
GetDeviceProfilesForApplicationID returns a slice of device-profiles that can be used for the given application id (based on the service-profile of the application).
func GetDeviceProfilesForOrganizationID ¶
func GetDeviceProfilesForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int) ([]DeviceProfileMeta, error)
GetDeviceProfilesForOrganizationID returns a slice of device-profiles for the given organization id.
func GetDeviceProfilesForUser ¶
func GetDeviceProfilesForUser(ctx context.Context, db sqlx.Queryer, username string, limit, offset int) ([]DeviceProfileMeta, error)
GetDeviceProfilesForUser returns a slice of device-profiles for the given username.
type ExtraChannel ¶
type ExtraChannel struct { Modulation string Frequency int Bandwidth int Bitrate int SpreadingFactors []int }
ExtraChannel defines an extra channel for the gateway-profile.
type FUOTADeployment ¶
type FUOTADeployment struct { ID uuid.UUID `db:"id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` MulticastGroupID *uuid.UUID `db:"multicast_group_id"` GroupType FUOTADeploymentGroupType `db:"group_type"` DR int `db:"dr"` Frequency int `db:"frequency"` PingSlotPeriod int `db:"ping_slot_period"` FragmentationMatrix uint8 `db:"fragmentation_matrix"` Descriptor [4]byte `db:"descriptor"` Payload []byte `db:"payload"` FragSize int `db:"frag_size"` Redundancy int `db:"redundancy"` BlockAckDelay int `db:"block_ack_delay"` MulticastTimeout int `db:"multicast_timeout"` State FUOTADeploymentState `db:"state"` UnicastTimeout time.Duration `db:"unicast_timeout"` NextStepAfter time.Time `db:"next_step_after"` }
FUOTADeployment defiles a firmware update over the air deployment.
func GetFUOTADeployment ¶
func GetFUOTADeployment(ctx context.Context, db sqlx.Ext, id uuid.UUID, forUpdate bool) (FUOTADeployment, error)
GetFUOTADeployment returns the FUOTA deployment for the given ID.
func GetPendingFUOTADeployments ¶
func GetPendingFUOTADeployments(ctx context.Context, db sqlx.Ext, batchSize int) ([]FUOTADeployment, error)
GetPendingFUOTADeployments returns the pending FUOTA deployments.
type FUOTADeploymentDevice ¶
type FUOTADeploymentDevice struct { FUOTADeploymentID uuid.UUID `db:"fuota_deployment_id"` DevEUI lorawan.EUI64 `db:"dev_eui"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` State FUOTADeploymentDeviceState `db:"state"` ErrorMessage string `db:"error_message"` }
FUOTADeploymentDevice defines the device record of a FUOTA deployment.
func GetFUOTADeploymentDevice ¶
func GetFUOTADeploymentDevice(ctx context.Context, db sqlx.Queryer, fuotaDeploymentID uuid.UUID, devEUI lorawan.EUI64) (FUOTADeploymentDevice, error)
GetFUOTADeploymentDevice returns the FUOTA deployment record for the given device.
func GetPendingFUOTADeploymentDevice ¶
func GetPendingFUOTADeploymentDevice(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64) (FUOTADeploymentDevice, error)
GetPendingFUOTADeploymentDevice returns the pending FUOTA deployment record for the given DevEUI.
type FUOTADeploymentDeviceListItem ¶
type FUOTADeploymentDeviceListItem struct { CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` FUOTADeploymentID uuid.UUID `db:"fuota_deployment_id"` DevEUI lorawan.EUI64 `db:"dev_eui"` DeviceName string `db:"device_name"` State FUOTADeploymentDeviceState `db:"state"` ErrorMessage string `db:"error_message"` }
FUOTADeploymentDeviceListItem defines the Device as FUOTA deployment list item.
type FUOTADeploymentDeviceState ¶
type FUOTADeploymentDeviceState string
FUOTADeploymentDeviceState defines the fuota deployment device state.
const ( FUOTADeploymentDevicePending FUOTADeploymentDeviceState = "PENDING" FUOTADeploymentDeviceSuccess FUOTADeploymentDeviceState = "SUCCESS" FUOTADeploymentDeviceError FUOTADeploymentDeviceState = "ERROR" )
FUOTA deployment device states.
type FUOTADeploymentFilters ¶
type FUOTADeploymentFilters struct { DevEUI lorawan.EUI64 `db:"dev_eui"` ApplicationID int64 `db:"application_id"` // Limit and Offset are added for convenience so that this struct can // be given as the arguments. Limit int `db:"limit"` Offset int `db:"offset"` }
FUOTADeploymentFilter provides filters that can be used to filter on FUOTA deployments. Note that empty values are not used as filters.
func (FUOTADeploymentFilters) SQL ¶
func (f FUOTADeploymentFilters) SQL() string
SQL returns the SQL filter.
type FUOTADeploymentGroupType ¶
type FUOTADeploymentGroupType string
FUOTADeploymentGroupType defines the group-type.
const ( FUOTADeploymentGroupTypeB FUOTADeploymentGroupType = "B" FUOTADeploymentGroupTypeC FUOTADeploymentGroupType = "C" )
FUOTA deployment group types.
type FUOTADeploymentListItem ¶
type FUOTADeploymentListItem struct { ID uuid.UUID `db:"id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` State FUOTADeploymentState `db:"state"` NextStepAfter time.Time `db:"next_step_after"` }
FUOTADeploymentListItem defines a FUOTA deployment item for listing.
func GetFUOTADeployments ¶
func GetFUOTADeployments(ctx context.Context, db sqlx.Queryer, filters FUOTADeploymentFilters) ([]FUOTADeploymentListItem, error)
GetFUOTADeployments returns a slice of fuota deployments.
type FUOTADeploymentState ¶
type FUOTADeploymentState string
FUOTADeploymentState defines the fuota deployment state.
const ( FUOTADeploymentMulticastCreate FUOTADeploymentState = "MC_CREATE" FUOTADeploymentMulticastSetup FUOTADeploymentState = "MC_SETUP" FUOTADeploymentFragmentationSessSetup FUOTADeploymentState = "FRAG_SESS_SETUP" FUOTADeploymentMulticastSessCSetup FUOTADeploymentState = "MC_SESS_C_SETUP" FUOTADeploymentEnqueue FUOTADeploymentState = "ENQUEUE" FUOTADeploymentStatusRequest FUOTADeploymentState = "STATUS_REQUEST" FUOTADeploymentSetDeviceStatus FUOTADeploymentState = "SET_DEVICE_STATUS" FUOTADeploymentCleanup FUOTADeploymentState = "CLEANUP" FUOTADeploymentDone FUOTADeploymentState = "DONE" )
FUOTA deployment states.
type GPSPoint ¶
GPSPoint contains a GPS point.
type Gateway ¶
type Gateway struct { MAC lorawan.EUI64 `db:"mac"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` FirstSeenAt *time.Time `db:"first_seen_at"` LastSeenAt *time.Time `db:"last_seen_at"` Name string `db:"name"` Description string `db:"description"` OrganizationID int64 `db:"organization_id"` Ping bool `db:"ping"` LastPingID *int64 `db:"last_ping_id"` LastPingSentAt *time.Time `db:"last_ping_sent_at"` NetworkServerID int64 `db:"network_server_id"` GatewayProfileID *string `db:"gateway_profile_id"` Latitude float64 `db:"latitude"` Longitude float64 `db:"longitude"` Altitude float64 `db:"altitude"` }
Gateway represents a gateway.
func GetGateway ¶
func GetGateway(ctx context.Context, db sqlx.Queryer, mac lorawan.EUI64, forUpdate bool) (Gateway, error)
GetGateway returns the gateway for the given mac.
func GetGateways ¶
func GetGateways(ctx context.Context, db sqlx.Queryer, limit, offset int, search string) ([]Gateway, error)
GetGateways returns a slice of gateways sorted by name.
func GetGatewaysForOrganizationID ¶
func GetGatewaysForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int, search string) ([]Gateway, error)
GetGatewaysForOrganizationID returns a slice of gateways sorted by name for the given organization ID.
type GatewayLocation ¶
type GatewayLocation struct { Latitude float64 `db:"latitude"` Longitude float64 `db:"longitude"` Altitude float64 `db:"altitude"` }
GatewayLocation represents a gateway location.
func GetGatewaysLoc ¶
GetGatewaysLoc returns a slice of gateways locations.
type GatewayPing ¶
type GatewayPing struct { ID int64 `db:"id"` CreatedAt time.Time `db:"created_at"` GatewayMAC lorawan.EUI64 `db:"gateway_mac"` Frequency int `db:"frequency"` DR int `db:"dr"` }
GatewayPing represents a gateway ping.
func GetGatewayPing ¶
GetGatewayPing returns the ping matching the given id.
type GatewayPingRX ¶
type GatewayPingRX struct { ID int64 `db:"id"` PingID int64 `db:"ping_id"` CreatedAt time.Time `db:"created_at"` GatewayMAC lorawan.EUI64 `db:"gateway_mac"` ReceivedAt *time.Time `db:"received_at"` RSSI int `db:"rssi"` LoRaSNR float64 `db:"lora_snr"` Location GPSPoint `db:"location"` Altitude float64 `db:"altitude"` }
GatewayPingRX represents a ping received by one of the gateways.
func GetGatewayPingRXForPingID ¶
func GetGatewayPingRXForPingID(ctx context.Context, db sqlx.Queryer, pingID int64) ([]GatewayPingRX, error)
GetGatewayPingRXForPingID returns the received gateway pings for the given ping ID.
type GatewayProfile ¶
type GatewayProfile struct { NetworkServerID int64 `db:"network_server_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` GatewayProfile ns.GatewayProfile `db:"-"` }
GatewayProfile defines a gateway-profile.
func GetGatewayProfile ¶
GetGatewayProfile returns the gateway-profile matching the given id.
type GatewayProfileMeta ¶
type GatewayProfileMeta struct { GatewayProfileID uuid.UUID `db:"gateway_profile_id"` NetworkServerID int64 `db:"network_server_id"` NetworkServerName string `db:"network_server_name"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` }
GatewayProfileMeta defines the gateway-profile meta record.
func GetGatewayProfiles ¶
func GetGatewayProfiles(ctx context.Context, db sqlx.Queryer, limit, offset int) ([]GatewayProfileMeta, error)
GetGatewayProfiles returns a slice of gateway-profiles.
func GetGatewayProfilesForNetworkServerID ¶
func GetGatewayProfilesForNetworkServerID(ctx context.Context, db sqlx.Queryer, networkServerID int64, limit, offset int) ([]GatewayProfileMeta, error)
GetGatewayProfilesForNetworkServerID returns a slice of gateway-profiles for the given network-server ID.
type Integration ¶
type Integration struct { ID int64 `db:"id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` ApplicationID int64 `db:"application_id"` Kind string `db:"kind"` Settings json.RawMessage `db:"settings"` }
Integration represents an integration.
func GetIntegration ¶
GetIntegration returns the Integration for the given id.
func GetIntegrationByApplicationID ¶
func GetIntegrationByApplicationID(ctx context.Context, db sqlx.Queryer, applicationID int64, kind string) (Integration, error)
GetIntegrationByApplicationID returns the Integration for the given application id and kind.
func GetIntegrationsForApplicationID ¶
func GetIntegrationsForApplicationID(ctx context.Context, db sqlx.Queryer, applicationID int64) ([]Integration, error)
GetIntegrationsForApplicationID returns the integrations for the given application id.
type MetricsRecord ¶
MetricsRecord holds a single metrics record.
func GetMetrics ¶
func GetMetrics(ctx context.Context, p *redis.Pool, agg AggregationInterval, name string, start, end time.Time) ([]MetricsRecord, error)
GetMetrics returns the metrics for the requested aggregation interval.
type MulticastGroup ¶
type MulticastGroup struct { CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` MCAppSKey lorawan.AES128Key `db:"mc_app_s_key"` MCKey lorawan.AES128Key `db:"mc_key"` ServiceProfileID uuid.UUID `db:"service_profile_id"` MulticastGroup ns.MulticastGroup `db:"-"` }
MulticastGroup defines the multicast-group.
type MulticastGroupFilters ¶
type MulticastGroupFilters struct { OrganizationID int64 `db:"organization_id"` ServiceProfileID uuid.UUID `db:"service_profile_id"` DevEUI lorawan.EUI64 `db:"dev_eui"` Search string `db:"search"` // Limit and Offset are added for convenience so that this struct can // be given as the arguments. Limit int `db:"limit"` Offset int `db:"offset"` }
MulticastGroupFilters provide filters that can be used to filter on multicast-groups. Note that empty values are not used as filters.
func (MulticastGroupFilters) SQL ¶
func (f MulticastGroupFilters) SQL() string
SQL returns the SQL filter.
type MulticastGroupListItem ¶
type MulticastGroupListItem struct { ID uuid.UUID `db:"id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` ServiceProfileID uuid.UUID `db:"service_profile_id"` ServiceProfileName string `db:"service_profile_name"` }
MulticastGroupListItem defines the multicast-group for listing.
func GetMulticastGroups ¶
func GetMulticastGroups(ctx context.Context, db sqlx.Queryer, filters MulticastGroupFilters) ([]MulticastGroupListItem, error)
GetMulticastGroups returns a slice of multicast-groups, given the privded filters. Note that empty values are not used as filters.
type NetworkServer ¶
type NetworkServer struct { ID int64 `db:"id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` Server string `db:"server"` CACert string `db:"ca_cert"` TLSCert string `db:"tls_cert"` TLSKey string `db:"tls_key"` RoutingProfileCACert string `db:"routing_profile_ca_cert"` RoutingProfileTLSCert string `db:"routing_profile_tls_cert"` RoutingProfileTLSKey string `db:"routing_profile_tls_key"` GatewayDiscoveryEnabled bool `db:"gateway_discovery_enabled"` GatewayDiscoveryInterval int `db:"gateway_discovery_interval"` GatewayDiscoveryTXFrequency int `db:"gateway_discovery_tx_frequency"` GatewayDiscoveryDR int `db:"gateway_discovery_dr"` }
NetworkServer defines the information to connect to a network-server.
func GetNetworkServer ¶
GetNetworkServer returns the network-server matching the given id.
func GetNetworkServerForDevEUI ¶
func GetNetworkServerForDevEUI(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64) (NetworkServer, error)
GetNetworkServerForDevEUI returns the network-server for the given DevEUI.
func GetNetworkServerForDeviceProfileID ¶
func GetNetworkServerForDeviceProfileID(ctx context.Context, db sqlx.Queryer, id uuid.UUID) (NetworkServer, error)
GetNetworkServerForDeviceProfileID returns the network-server for the given device-profile id.
func GetNetworkServerForGatewayMAC ¶
func GetNetworkServerForGatewayMAC(ctx context.Context, db sqlx.Queryer, mac lorawan.EUI64) (NetworkServer, error)
GetNetworkServerForGatewayMAC returns the network-server for a given gateway mac.
func GetNetworkServerForGatewayProfileID ¶
func GetNetworkServerForGatewayProfileID(ctx context.Context, db sqlx.Queryer, id uuid.UUID) (NetworkServer, error)
GetNetworkServerForGatewayProfileID returns the network-server for the given gateway-profile id.
func GetNetworkServerForMulticastGroupID ¶
func GetNetworkServerForMulticastGroupID(ctx context.Context, db sqlx.Queryer, id uuid.UUID) (NetworkServer, error)
GetNetworkServerForMulticastGroupID returns the network-server for the given multicast-group id.
func GetNetworkServerForServiceProfileID ¶
func GetNetworkServerForServiceProfileID(ctx context.Context, db sqlx.Queryer, id uuid.UUID) (NetworkServer, error)
GetNetworkServerForServiceProfileID returns the network-server for the given service-profile id.
func GetNetworkServers ¶
func GetNetworkServers(ctx context.Context, db sqlx.Queryer, limit, offset int) ([]NetworkServer, error)
GetNetworkServers returns a slice of network-servers.
func GetNetworkServersForOrganizationID ¶
func GetNetworkServersForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int) ([]NetworkServer, error)
GetNetworkServersForOrganizationID returns a slice of network-server accessible for the given organization id. A network-server is accessible for an organization when it is used by one of its service-profiles.
func (NetworkServer) Validate ¶
func (ns NetworkServer) Validate() error
Validate validates the network-server data.
type Organization ¶
type Organization struct { ID int64 `db:"id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` DisplayName string `db:"display_name"` CanHaveGateways bool `db:"can_have_gateways"` }
Organization represents an organization.
func GetOrganization ¶
GetOrganization returns the Organization for the given id.
func GetOrganizations ¶
func GetOrganizations(ctx context.Context, db sqlx.Queryer, limit, offset int, search string) ([]Organization, error)
GetOrganizations returns a slice of organizations, sorted by name and respecting the given limit and offset.
func GetOrganizationsForUser ¶
func GetOrganizationsForUser(ctx context.Context, db sqlx.Queryer, username string, limit, offset int, search string) ([]Organization, error)
GetOrganizationsForUser returns a slice of organizations to which the given user is member of.
func (Organization) Validate ¶
func (o Organization) Validate() error
Validate validates the data of the Organization.
type OrganizationUser ¶
type OrganizationUser struct { UserID int64 `db:"user_id"` Username string `db:"username"` IsAdmin bool `db:"is_admin"` IsDeviceAdmin bool `db:"is_device_admin"` IsGatewayAdmin bool `db:"is_gateway_admin"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
OrganizationUser represents an organization user.
func GetOrganizationUser ¶
func GetOrganizationUser(ctx context.Context, db sqlx.Queryer, organizationID, userID int64) (OrganizationUser, error)
GetOrganizationUser gets the information of the given organization user.
func GetOrganizationUsers ¶
func GetOrganizationUsers(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int) ([]OrganizationUser, error)
GetOrganizationUsers returns the users for the given organization.
type RemoteFragmentationSession ¶
type RemoteFragmentationSession struct { DevEUI lorawan.EUI64 `db:"dev_eui"` FragIndex int `db:"frag_index"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` MCGroupIDs []int `db:"mc_group_ids"` NbFrag int `db:"nb_frag"` FragSize int `db:"frag_size"` FragmentationMatrix uint8 `db:"fragmentation_matrix"` BlockAckDelay int `db:"block_ack_delay"` Padding int `db:"padding"` Descriptor [4]byte `db:"descriptor"` State RemoteMulticastSetupState `db:"state"` StateProvisioned bool `db:"state_provisioned"` RetryAfter time.Time `db:"retry_after"` RetryCount int `db:"retry_count"` RetryInterval time.Duration `db:"retry_interval"` }
RemoteFragmentationSession defines a remote fragmentation session record.
func GetPendingRemoteFragmentationSessions ¶
func GetPendingRemoteFragmentationSessions(ctx context.Context, db sqlx.Queryer, limit, maxRetryCount int) ([]RemoteFragmentationSession, error)
GetPendingRemoteFragmentationSessions returns a slice of pending remote fragmentation sessions.
func GetRemoteFragmentationSession ¶
func GetRemoteFragmentationSession(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64, fragIndex int, forUpdate bool) (RemoteFragmentationSession, error)
GetRemoteFragmentationSession returns the fragmentation session given a DevEUI and fragmentation index.
type RemoteMulticastClassCSession ¶
type RemoteMulticastClassCSession struct { DevEUI lorawan.EUI64 `db:"dev_eui"` MulticastGroupID uuid.UUID `db:"multicast_group_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` McGroupID int `db:"mc_group_id"` SessionTime time.Time `db:"session_time"` SessionTimeOut int `db:"session_time_out"` DLFrequency int `db:"dl_frequency"` DR int `db:"dr"` StateProvisioned bool `db:"state_provisioned"` RetryAfter time.Time `db:"retry_after"` RetryCount int `db:"retry_count"` RetryInterval time.Duration `db:"retry_interval"` }
RemoteMulticastClassCSession defines a remote multicast-setup Class-C session record.
func GetPendingRemoteMulticastClassCSessions ¶
func GetPendingRemoteMulticastClassCSessions(ctx context.Context, db sqlx.Queryer, limit, maxRetryCount int) ([]RemoteMulticastClassCSession, error)
GetPendingRemoteMulticastClassCSessions returns a slice of pending remote multicast Class-C sessions.
func GetRemoteMulticastClassCSession ¶
func GetRemoteMulticastClassCSession(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64, multicastGroupID uuid.UUID, forUpdate bool) (RemoteMulticastClassCSession, error)
GetRemoteMulticastClassCSession returns the multicast Class-C session given a DevEUI and multicast-group ID.
func GetRemoteMulticastClassCSessionByGroupID ¶
func GetRemoteMulticastClassCSessionByGroupID(ctx context.Context, db sqlx.Queryer, devEUI lorawan.EUI64, mcGroupID int, forUpdate bool) (RemoteMulticastClassCSession, error)
GetRemoteMulticastClassCSessionByGroupID returns the multicast Class-C session given a DevEUI and McGroupID.
type RemoteMulticastSetup ¶
type RemoteMulticastSetup struct { DevEUI lorawan.EUI64 `db:"dev_eui"` MulticastGroupID uuid.UUID `db:"multicast_group_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` McGroupID int `db:"mc_group_id"` McAddr lorawan.DevAddr `db:"mc_addr"` McKeyEncrypted lorawan.AES128Key `db:"mc_key_encrypted"` MinMcFCnt uint32 `db:"min_mc_f_cnt"` MaxMcFCnt uint32 `db:"max_mc_f_cnt"` State RemoteMulticastSetupState `db:"state"` StateProvisioned bool `db:"state_provisioned"` RetryInterval time.Duration `db:"retry_interval"` RetryAfter time.Time `db:"retry_after"` RetryCount int `db:"retry_count"` }
RemoteMulticastSetup defines a remote multicast-setup record.
func GetPendingRemoteMulticastSetupItems ¶
func GetPendingRemoteMulticastSetupItems(ctx context.Context, db sqlx.Queryer, limit, maxRetryCount int) ([]RemoteMulticastSetup, error)
GetPendingRemoteMulticastSetupItems returns a slice of pending remote multicast-setup items. The selected items will be locked.
type RemoteMulticastSetupState ¶
type RemoteMulticastSetupState string
RemoteMulticastSetupState defines the state type.
const ( RemoteMulticastSetupSetup RemoteMulticastSetupState = "SETUP" RemoteMulticastSetupDelete RemoteMulticastSetupState = "DELETE" )
Possible states
type SearchResult ¶
type SearchResult struct { Kind string `db:"kind"` Score float64 `db:"score"` OrganizationID *int64 `db:"organization_id"` OrganizationName *string `db:"organization_name"` ApplicationID *int64 `db:"application_id"` ApplicationName *string `db:"application_name"` DeviceDevEUI *lorawan.EUI64 `db:"device_dev_eui"` DeviceName *string `db:"device_name"` GatewayMAC *lorawan.EUI64 `db:"gateway_mac"` GatewayName *string `db:"gateway_name"` }
SearchResult defines a search result.
type ServiceProfile ¶
type ServiceProfile struct { NetworkServerID int64 `db:"network_server_id"` OrganizationID int64 `db:"organization_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` ServiceProfile ns.ServiceProfile `db:"-"` }
ServiceProfile defines the service-profile.
func GetServiceProfile ¶
func GetServiceProfile(ctx context.Context, db sqlx.Queryer, id uuid.UUID, localOnly bool) (ServiceProfile, error)
GetServiceProfile returns the service-profile matching the given id.
func (ServiceProfile) Validate ¶
func (sp ServiceProfile) Validate() error
Validate validates the service-profile data.
type ServiceProfileMeta ¶
type ServiceProfileMeta struct { ServiceProfileID uuid.UUID `db:"service_profile_id"` NetworkServerID int64 `db:"network_server_id"` OrganizationID int64 `db:"organization_id"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` Name string `db:"name"` }
ServiceProfileMeta defines the service-profile meta record.
func GetServiceProfiles ¶
func GetServiceProfiles(ctx context.Context, db sqlx.Queryer, limit, offset int) ([]ServiceProfileMeta, error)
GetServiceProfiles returns a slice of service-profiles.
func GetServiceProfilesForOrganizationID ¶
func GetServiceProfilesForOrganizationID(ctx context.Context, db sqlx.Queryer, organizationID int64, limit, offset int) ([]ServiceProfileMeta, error)
GetServiceProfilesForOrganizationID returns a slice of service-profiles for the given organization id.
func GetServiceProfilesForUser ¶
func GetServiceProfilesForUser(ctx context.Context, db sqlx.Queryer, username string, limit, offset int) ([]ServiceProfileMeta, error)
GetServiceProfilesForUser returns a slice of service-profile for the given username.
type TxLogger ¶
TxLogger logs the executed sql queries and their duration.
type User ¶
type User struct { ID int64 `db:"id"` Username string `db:"username"` IsAdmin bool `db:"is_admin"` IsActive bool `db:"is_active"` SessionTTL int32 `db:"session_ttl"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` PasswordHash string `db:"password_hash"` Email string `db:"email"` Note string `db:"note"` SecurityToken *string `db:"security_token"` }
User represents a user to external code.
func GetTokenByUsername ¶
GetTokenByUsername ...
func GetUserByToken ¶
GetUserByToken ...
func GetUserByUsername ¶
GetUserByUsername returns the User for the given username.
type UserProfile ¶
type UserProfile struct { User UserProfileUser Organizations []UserProfileOrganization }
UserProfile contains the profile of the user.
func GetProfile ¶
GetProfile returns the user profile (user, applications and organizations to which the user is linked).
type UserProfileOrganization ¶
type UserProfileOrganization struct { ID int64 `db:"organization_id"` Name string `db:"organization_name"` IsAdmin bool `db:"is_admin"` IsDeviceAdmin bool `db:"is_device_admin"` IsGatewayAdmin bool `db:"is_gateway_admin"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
UserProfileOrganization contains the organizations to which the user is linked.
type UserProfileUser ¶
type UserProfileUser struct { ID int64 `db:"id"` Username string `db:"username"` IsAdmin bool `db:"is_admin"` IsActive bool `db:"is_active"` SessionTTL int32 `db:"session_ttl"` CreatedAt time.Time `db:"created_at"` UpdatedAt time.Time `db:"updated_at"` }
UserProfileUser contains the user information of the profile.
type UserUpdate ¶
type UserUpdate struct { ID int64 `db:"id"` Username string `db:"username"` IsAdmin bool `db:"is_admin"` IsActive bool `db:"is_active"` SessionTTL int32 `db:"session_ttl"` Email string `db:"email"` Note string `db:"note"` }
UserUpdate represents the user fields that can be "updated" in the simple case. This excludes id, which identifies the record to be updated.
Source Files ¶
- application.go
- board.go
- db.go
- device.go
- device_profile.go
- errors.go
- fuota_deployment.go
- gateway.go
- gateway_profile.go
- integrations.go
- metrics.go
- multicast_group.go
- network_server.go
- network_server_helpers.go
- organization.go
- remote_fragmentation_session.go
- remote_multicast_class_c_session.go
- remote_multicast_setup.go
- search.go
- service_profile.go
- storage.go
- user.go