question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeCast seems doesnt work

See original GitHub issue
const mysql2 = require('mysql2');

const pool = mysql2.createPool({
    host:'localhost', user: 'admindb', database: 'tests',password:'password',charset:'UTF8MB4_UNICODE_CI',timezone:'Z',
    typeCast: (field, next) => {
        console.log('typeCast');
        if (field.type === "BIT") {
            console.log(field);
            console.log(field.buffer());
            return field.buffer()[0] == 1;
        }
        return next()
    }

});;
const promisePool = pool.promise();
export default {pool, promisePool}

Doesn’t call with execute. dup: https://github.com/sidorares/node-mysql2/issues/649 https://github.com/sidorares/node-mysql2/issues/347

How i can turn <Buffer xx> to bool/int? https://dev.mysql.com/doc/refman/8.0/en/bit-type.html

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:1
  • Comments:16 (14 by maintainers)

github_iconTop GitHub Comments

2reactions
sidorarescommented, Apr 12, 2019
const payload = { ...lastRow, active: lastRow.active[0] === 1, login_changed: lastRow.login_changed[0] === 1 };

to avoid delete payload.password:

const { password, ...payload } = { ...lastRow, active: lastRow.active[0] === 1, login_changed: lastRow.login_changed[0] === 1 };
1reaction
jjeejjcommented, Dec 2, 2020

Now, Whether the feature(typeCast) is supported ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

type casting in C# doesn't work - Stack Overflow
Casting in C# will try to find an appropriate casting operator. If the target object either is an int or has an appropriate...
Read more >
Developers - TypeCast seems doesnt work - - Bountysource
TypeCast seems doesnt work.
Read more >
Type Casting in Acting... All You Need to Know - City Headshots
It's very common for new actors to worry about being typecast because they don't want to be locked into only playing a particular...
Read more >
Is Apex Casting is not transitive? - Salesforce Stack Exchange
Basically, casting a Decimal from an Object reference to an Integer reference is invalid, because it's not a compatible type.
Read more >
Completely remove casting ability from PC to TV - Super User
Try this : Open chrome://flags/ in Chrome, type cast in the search field and disable every related option. Restart Chrome. · It doesnt...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found