Skip to content

Format queries to stay within 80 character limit #31

Description

@finnhodgkin

If you use template literals for your queries then they can be on multiple lines. I would also recommend formatting queries with all caps for postgres functionality - it's the industry standard and makes reading queries a bunch easier:

  connect.query(
    'select tasks.id,tasks.description,tasks.priority,tasks.time_started, tasks.time_finished, tasks.user_id, users.name from tasks inner join users on users.id=tasks.user_id where tasks.user_id = $1',
    [query.user],
    (err, res) => {
...

vs

  connect.query(`
    SELECT  T.id, T.description, T.priority, T.time_started, T.time_finished, 
    T.user_id, U.name 
    FROM tasks T INNER JOIN users U ON U.id=T.user_id 
    WHERE T.user_id = $1`,
    [query.user],
    (err, res) => {
...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions