dart_postgres_wrapper 1.0.9

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • 69

dart_postgres_wrapper #

A simple postgres database wrapper. Makes it easy to use postgres requests.

Available methods #

  • createConnection
  • createTable
  • drop
  • copy
  • replace
  • setPrimaryKey
  • setColType
  • select
  • insert
  • deleteAll

Example #

import 'package:dart_postgres_wrapper/dart_postgres_wrapper.dart';
import 'package:dart_postgres_wrapper/data_type.dart';

main(List<String> arguments) async {
  String host = 'localhost';
  int port = 5432;
  String db = 'test';
  String dbUser = 'dbUser';
  String dbPassword = 'Password';
  String tab = 'tab';
  var pg = new PG(host, port, db, dbUser, dbPassword, tab);
  
  await pg.createConnection();
  
  await pg.createTable([
    new FieldAndType('nomenklatura', 'text'),
    new FieldAndType('magazin', 'text'),
    new FieldAndType('summaProdazhTyisRub', 'text'),
    new FieldAndType('natsenkaTyisRub', 'text'),
    new FieldAndType('natsenkaProc', 'text'),
  ]);

  await pg.copy('/opt/DataToImport2.csv', isCsv: true);

  await pg.replace('natsenkaProc', ',', '.');
  await pg.replace('natsenkaTyisRub', ',', '.');
  await pg.replace('summaProdazhTyisRub', ',', '.');

  await pg.setPrimaryKey();
  
  await pg.setColType('natsenkaProc', 'double precision');
  await pg.setColType('natsenkaTyisRub', 'double precision');
  await pg.setColType('summaProdazhTyisRub', 'double precision');

  print(await pg.select(whereIdFrom: 1, whereIdTo: 5));
  
  pg.drop();
}

1.0.0 #

  • Initial version, created by Stagehand

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  dart_postgres_wrapper: ^1.0.9

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:dart_postgres_wrapper/dart_postgres_wrapper.dart';
  
Version Uploaded Documentation Archive
1.0.9 Dec 10, 2018 Go to the documentation of dart_postgres_wrapper 1.0.9 Download dart_postgres_wrapper 1.0.9 archive
1.0.8 Dec 7, 2018 Go to the documentation of dart_postgres_wrapper 1.0.8 Download dart_postgres_wrapper 1.0.8 archive
1.0.7 Dec 7, 2018 Go to the documentation of dart_postgres_wrapper 1.0.7 Download dart_postgres_wrapper 1.0.7 archive
1.0.6 Dec 7, 2018 Go to the documentation of dart_postgres_wrapper 1.0.6 Download dart_postgres_wrapper 1.0.6 archive
1.0.5 Dec 7, 2018 Go to the documentation of dart_postgres_wrapper 1.0.5 Download dart_postgres_wrapper 1.0.5 archive
1.0.4 Dec 6, 2018 Go to the documentation of dart_postgres_wrapper 1.0.4 Download dart_postgres_wrapper 1.0.4 archive
1.0.3 Dec 5, 2018 Go to the documentation of dart_postgres_wrapper 1.0.3 Download dart_postgres_wrapper 1.0.3 archive
1.0.2 Dec 5, 2018 Go to the documentation of dart_postgres_wrapper 1.0.2 Download dart_postgres_wrapper 1.0.2 archive
1.0.1 Nov 30, 2018 Go to the documentation of dart_postgres_wrapper 1.0.1 Download dart_postgres_wrapper 1.0.1 archive
1.0.0 Nov 30, 2018 Go to the documentation of dart_postgres_wrapper 1.0.0 Download dart_postgres_wrapper 1.0.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
53
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
69
Learn more about scoring.

We analyzed this package on Apr 25, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14

Platforms

Detected platforms: Flutter, other

Primary library: package:dart_postgres_wrapper/dart_postgres_wrapper.dart with components: io.

Health issues and suggestions

Document public APIs. (-1 points)

37 out of 37 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix bin/main.dart. (-1.49 points)

Analysis of bin/main.dart reported 3 hints:

line 2 col 8: Unused import: 'package:dart_postgres_wrapper/data_type.dart'.

line 11 col 7: The value of the local variable 'from' isn't used.

line 12 col 7: The value of the local variable 'to' isn't used.

Fix lib/dart_postgres_wrapper.dart. (-1.49 points)

Analysis of lib/dart_postgres_wrapper.dart reported 3 hints:

line 27 col 12: Use isNotEmpty instead of length

line 77 col 10: Use isNotEmpty instead of length

line 108 col 10: Use isNotEmpty instead of length

Format lib/data_type.dart.

Run dartfmt to format lib/data_type.dart.

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and dart_postgres_wrapper.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
csv ^4.0.1 4.0.3
postgres ^1.0.2 1.0.2
Transitive dependencies
charcode 1.1.2
collection 1.14.11
convert 2.1.1
crypto 2.0.6
typed_data 1.1.6
Dev dependencies
test ^1.0.0