geiger_dummy_data 0.3.6 icon indicating copy to clipboard operation
geiger_dummy_data: ^0.3.6 copied to clipboard

A dart package that provides functionality for easy propagation of data to the Geiger localStorage for testing purposes.

Authors #

#GEIGER DUMMY DATA

This repository contains classes that provides methods to easily set and get data from the Node paths provided in the Geiger Indicator docs.

Features #

  • Receive data as a json object from a specific NodeValue path.
  • Access to functionality to help you serialized and deserialized data.
  • Set data according the Node path already defined in the geiger indicator docs.
  • Auto generation of uuids for userId, deviceId, threatId, recommendationId, roleId, etc.
  • Access to Data models

Getting started #

Run the following command in your terminal, to add the package in your pubspec.yaml

  Flutter pub add geiger_dummy_data
  or
  dart pub add geiger_dummy_data

Additional information for flutter users #

Also run the following command in your terminal, to add the package in your pubspec.yaml

 flutter pub add sqlite3_flutter_libs
 flutter pub add sqflite 
 
 

Usage #

A short and useful examples for package users. Check /example folder for more details.

import "package:geiger_dummy_data/geiger_dummy_data.dart";
import 'package:geiger_localstorage/geiger_localstorage.dart';

//flutter users only: uncomment the import lines below
// import 'package:path/path.dart';
// import 'package:sqflite/sqflite.dart';



void main() {



  //flutter user only
  //initialize database
  void _iniDatabase() async{
    String dbPath = join(await getDatabasesPath(), 'database.db');
    StorageController _storageController = GenericController('Example', SqliteMapper(dbPath));
  }
  
  
  //dart users
  //initialize database
  StorageController _storageController =
  GenericController("Example", SqliteMapper("./database.db"));
  
  

  //set and get threats from :Global:threats
  GeigerThreat _geigerThreat = GeigerThreat(_storageController);

  //store and retrieve threats from :Global:threats
  // return a List of Threat object containing threatId and name.
  List<Threat> getThreatInfo() {
    try {
      return _geigerThreat.getThreats;
    } catch (e) {
      //threat Json format  '[{"threatId": "t1", name":"phishing"},{"threatId":"t2","name":"malware"}]'
      //Threat to convert your json to Threat object
      // threatId is optional: is auto generated.
      List<Threat> threatData =
      Threat.convertFromJson('[{"name":"phishing"},{"name":"malware"}]');

      //store threat in :Global:threats:
      _geigerThreat.setGlobalThreatsNode = threatData;
      return _geigerThreat.getThreats;
    }
  }
  // display in terminal
  print(getThreatInfo());
}


Check test/geiger_dummy_data_test folder more demo

TODO:

  • Provide more functionality to set data and in the following Node path.
  • :EnterPrise:users
  • :Global:profile
  • :Local:plugin
  • :Users:userId:data:metrics
  • :Device:deviceId:data:metrics
  • Provide more data models
  • docs

TODO: This project is open to contribution and improvements

0
likes
110
pub points
0%
popularity

Publisher

unverified uploader

A dart package that provides functionality for easy propagation of data to the Geiger localStorage for testing purposes.

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.Apache-2.0 (LICENSE)

Dependencies

equatable, flutter, geiger_api, geiger_localstorage, intl, json_annotation, uuid

More

Packages that depend on geiger_dummy_data