Skip to content

misformat "->>" (json operation in Sqlite) #950

Description

@PengjuXu

steps

run below in Deno (I don't think this is specific to Deno)

import { format as sqlFormat } from "npm:sql-formatter";

// this works in Sqlite
const sqlText = `
select node.text->>'$._meta.id' as id
from node
`
const params = []  // empty

console.log(
  sqlFormat(sqlText, {params: params.map(p=>JSON.stringify(p))})
)
/*
result, "- > >" is error, not work in Sqlite
`
select
  node.text - > > '$._meta.id' as id
from
  node
`
*/

version

└─┬ npm:/sql-formatter@15.8.0 (2.96MB)
  ├── npm:/argparse@2.0.1 (167.53KB)
  └─┬ npm:/nearley@2.20.1 (74.04KB)
    ├── npm:/commander@2.20.3 (60.98KB)
    ├── npm:/moo@0.5.3 (32.04KB)
    ├── npm:/railroad-diagrams@1.0.0 (50.79KB)
    └─┬ npm:/randexp@0.4.6 (12.01KB)
      ├── npm:/discontinuous-range@1.0.0 (10.73KB)
      └── npm:/ret@0.1.15 (17.49KB)

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