Registry / database / fruit-mysql

fruit-mysql

JSON →
library0.0.4jsnpmunverified

MySQL adapter for the Fruit ORM (v0.0.4, experimental). Provides a MySQL backend for the Fruit Object-Relational Mapper, allowing MySQL connections with standard Fruit API. Key differentiators: lightweight, promise-based API with chainable .success()/.error() handlers; supports multiple insert statements. Alternative to Sequelize/TypeORM for simpler use cases. Current release is 0.0.4, last updated in 2015. Project is in experimental stage with low activity.

npm install fruit-mysql
INSTALL
IMPORT
SIG · FRUIT-MYSQL
F
fruit-mysql
databasejavascriptv0.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

fruit
import fruit from 'fruit'
const fruit = require('fruit')
CommonJS require works as well, but ESM import is preferred.
fruit-mysql
require('fruit-mysql')
import { fruit } from 'fruit-mysql'
fruit-mysql is not a module to import directly; it's a plugin/connector for fruit. Typically required before using fruit with MySQL.
fruit.connect
fruit.connect('mysql', options)
fruit.use('fruit-mysql')
The adapter is used by passing 'mysql' as first argument to fruit.connect(), not by using the package directly.

Demonstrates basic setup: install fruit and fruit-mysql, connect to MySQL, define a model, and save an instance.

const fruit = require('fruit'); require('fruit-mysql'); fruit.connect('mysql', { host: 'localhost', database: 'test', user: 'root', password: process.env.DB_PASSWORD ?? '' }); const User = fruit.model('User', { name: String, age: Number }); const user = new User({ name: 'Khalid', age: 26 }); user.save() .success(() => console.log('User saved')) .error(err => console.error(err));
Debug
Known issues
deprecatedProject is experimental and has not been updated since 2015. Consider using modern alternatives like Sequelize or TypeORM.
fix
Migrate to an actively maintained ORM such as Sequelize or TypeORM.
affects: >=0.0.0
breakingThe fruit package itself is experimental and may have breaking API changes across minor versions.
fix
Pin exact version of fruit and fruit-mysql in package.json.
affects: >=0.0.0
gotchaRequires 'fruit' core to be required before 'fruit-mysql' and fruit.connect() must be called with 'mysql' as first argument.
fix
Always require 'fruit' first, then 'fruit-mysql', then call fruit.connect('mysql', options).
affects: >=0.0.0
gotchaThe .insert() method with multiple statements requires 'multipleStatements: true' in options and a boolean true as second argument to insert().
fix
Set multipleStatements: true in options and call fruit.insert(data, true).
affects: >=0.0.0
Errors
Common errors & fixes
Cannot find module 'fruit'
fruit-mysql requires fruit as a peer dependency; missing fruit installation.
fix
Run 'npm install fruit' to install the core ORM.
fruit.connect is not a function
fruit-mysql not required before calling fruit.connect, or fruit module not loaded.
fix
Ensure require('fruit-mysql') is called after require('fruit') and before fruit.connect.
Connection lost: The server closed the connection.
MySQL server idle timeout or network issue. fruit-mysql does not handle reconnection automatically.
fix
Implement reconnection logic or use a connection pool.
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies
fruitrequiredORM core required to use this adapter
mysqlrequiredMySQL driver dependency
Agent activity
4 hits · last 30 days
node
4
Resources
fruit-mysql — npm install fruit-mysql · libregistry