utils

package
v0.0.0-...-ca683a2 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2024 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	GatewayConn    *client.Gateway
	ClientConn     *grpc.ClientConn
	ClientContract *client.Contract
)

Functions

func ConvertToRFC3339

func ConvertToRFC3339(unixtime string) string

func ConvertToUnixTime

func ConvertToUnixTime(datetime string) string

func CreateRecord

func CreateRecord(w http.ResponseWriter, r *http.Request)

func CreateUser

func CreateUser(w http.ResponseWriter, r *http.Request)

func DecompressRecord

func DecompressRecord(returnedRecord string) string

func Decrypt

func Decrypt(ciphertext string) (string, error)

func Encrypt

func Encrypt(plaintext string) (string, error)

For Testing purposes

func GetAllRecords

func GetAllRecords(w http.ResponseWriter, r *http.Request)

func GetAllRecordsForOneDrone

func GetAllRecordsForOneDrone(w http.ResponseWriter, r *http.Request)

func GetUser

func GetUser(w http.ResponseWriter, r *http.Request)

func GetUsers

func GetUsers(w http.ResponseWriter, r *http.Request)

func HelloFabric

func HelloFabric(w http.ResponseWriter, r *http.Request)

func ImportFromFile

func ImportFromFile(filePath string)

func InitGateway

func InitGateway()

InitGateway initializes the Gateway connection.

func InitLedger

func InitLedger(w http.ResponseWriter, r *http.Request)

func PKCS7Padding

func PKCS7Padding(data []byte, blockSize int) []byte

func PKCS7UnPadding

func PKCS7UnPadding(data []byte) []byte

func QueryRecordsWithSelectorJSON

func QueryRecordsWithSelectorJSON(w http.ResponseWriter, r *http.Request)

QueryRecordsWithSelectorJSON is a handler for querying records with selector in JSON format The selector is passed as a URL parameter

func TestQueryRecordsWithSelector

func TestQueryRecordsWithSelector(w http.ResponseWriter, r *http.Request)

Types

type RawRecord

type RawRecord struct {
	Drone                    string `json:"drone"`
	Story                    string `json:"story"`
	Zip                      string `json:"zip"`
	Datetime                 string `json:"datetime"`
	Temperature              string `json:"temperature"`
	Wind                     string `json:"wind"`
	Gust                     string `json:"gust"`
	Timesincelastmaintenance string `json:"timesincelastmaintenance"`
	Flighthours              string `json:"flighthours"`
	Pitch                    string `json:"pitch"`
	Roll                     string `json:"roll"`
	Yaw                      string `json:"yaw"`
	Vibex                    string `json:"vibex"`
	Vibey                    string `json:"vibey"`
	Vibez                    string `json:"vibez"`
	Nsat                     string `json:"nsat"`
	Noise                    string `json:"noise"`
	Currentslope             string `json:"currentslope"`
	Brownout                 string `json:"brownout"`
	Batterylevel             string `json:"batterylevel"`
	Crash                    string `json:"crash"`
}

type Record

type Record struct {
	DroneID   string `json:"droneID"`
	Zip       string `json:"zip"`
	FlyTime   string `json:"flyTime"`
	FlyRecord string `json:"flyRecord"`
	Reserved  string `json:"reserved"`
}

func CompressRecord

func CompressRecord(rawRecord *RawRecord) *Record

type User

type User struct {
	ID   string `json:"id"`
	Name string `json:"name"`
}

======================================== For testing purposes

Jump to

Keyboard shortcuts

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