2.2.0 • Published 2 years ago

@aponica/goosemgr-mysqlgoose-js v2.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

@aponica/goosemgr-mysqlgoose-js

Goose Manager for Mysqlgoose Database Abstraction.

A "Goose Manager" provides a consistent way to access an object or relational database.

A "Mysqlgoose Manager" allows Mysqlgoose to be managed consistently with other types of "Goose."

An equivalent JS package, aponica/goosemgr-mysqlgoose-php, is maintained for consistency.

Installation

npm i @aponica/goosemgr-mysqlgoose-js

Usage

Step 1: Create Configuration Files

Create a database connection file and Mysqlgoose definitions file according to the first two steps for @aponica/mysqlgoose-js.

Step 2: Use a Mysqlgoose Manager

Use class cMysqlgooseMgr to connect to your database and create the models, then use the models as specified in the @aponica/mysqlgoose-js documentation.

Examples

Example: Async/Await Syntax

Remember: await can only be used within an async function!

const cMysqlgooseMgr = require( '@aponica/goosemgr-mysqlgoose-js' );

const mgr = new cMysqlgooseMgr( 'definitions.json' );
  
await mgr.fpConnect( 'mysql.json' );

const cust = await mgr.fiModel( 'customer' ).findById( 1234 );
console.info( cust.id ); // 1234

Example: Promise-Based Syntax

This syntax can be used anywhere; for example, at the top level of a NodeJS application:

const cMysqlgooseMgr = require( '@aponica/goosemgr-mysqlgoose-js' );

const mgr = new cMysqlgooseMgr( 'definitions.json' );
  
mgr.fpConnect( 'mysql.json' ).then( () => {
  mgr.fiModel( 'customer' ).findById( 1234 ).
    then( cust => console.info( cust.id ) ); // 1234
  } );

Please Donate!

Help keep a roof over our heads and food on our plates! If you find aponica® open source software useful, please click here to make a one-time or recurring donation via PayPal, credit or debit card. Thank you kindly!

Unit Testing

The JEST unit tests require the test database and configuration as specified for @aponica/mysqlgoose-js.

Contributing

Please contact us if you believe this package is missing important functionality that you'd like to provide.

Under the covers, the code is heavily commented and uses a form of Hungarian notation for data type guidance. If you submit a pull request, please try to maintain the (admittedly unusual) coding style, which is the product of many decades of programming experience.

Copyright

Copyright 2019-2022 Opplaud LLC and other contributors.

License

MIT License.

Trademarks

OPPLAUD and aponica are registered trademarks of Opplaud LLC.

Related Links

Official links for this project:

Related projects:

2.2.0

2 years ago

2.1.0

2 years ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.2

2 years ago

0.0.1

2 years ago