Skip to content

Discussion [postgres]: How best to format multi-line json_build_object #77

Description

@joelmukuthu

Currently

SELECT json_build_object('foo', "foo", 'bar', "bar", 'baz', "baz", 'qux', "qux", 'quux', "quux");

Gets formatted as

SELECT
  json_build_object(
    'foo',
    "foo",
    'bar',
    "bar",
    'baz',
    "baz",
    'qux',
    "qux",
    'quux',
    "quux"
  );

This would be be easier to scan:

SELECT
  json_build_object(
    'foo', "foo",
    'bar', "bar",
    'baz', "baz",
    'qux', "qux",
    'quux', "quux"
  );

And I'd even suggest keeping that formatting style even when the 'foo', "foo" line is longer than 80 characters. Thoughts? :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions