dart_postgres_wrapper 1.0.9

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new54

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]
28
Health:
Code health derived from static analysis. [more]
89
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
70
Overall:
Weighted score of the above. [more]
54
Learn more about scoring.

We analyzed this package on Dec 10, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.1.0
  • pana: 0.12.7

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 (-10 points)

35 out of 35 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

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.

Format lib/dart_postgres_wrapper.dart.

Run dartfmt to format lib/dart_postgres_wrapper.dart.

Format lib/data_type.dart.

Run dartfmt to format lib/data_type.dart.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use dart_postgres_wrapper.dart.

Dependencies

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