Underscores or camelCase in PostgreSQL identifiers, when the programming language uses camelCase?

后端 未结 3 1695
悲&欢浪女
悲&欢浪女 2021-02-01 12:02

This has been bothering me for a while, and I can\'t arrive at a solution that feels right...

Given an OO language in which the usual naming convention for object

3条回答
  •  醉话见心
    2021-02-01 13:00

    I know this is late however for something that would be simple to translate on the fly, you could write a small help function that would live in your code as such:

    function FormatObjForDb(srcObj){

    const newObj = {};
    
    Object.keys(srcObj).forEach(key => newObj[key.toLowerCase()] = srcObj[key]);
    
    return newObj;
    

    }

    export const formatObjForDb = FormatObjForDb;

提交回复
热议问题