cockroachdb-parser

module
v0.23.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 12, 2024 License: Apache-2.0

README

cockroachdb-parser

Go Reference Tests

cockroachdb-parser is a snapshot of the parser package and all its dependencies from the CockroachDB repo. The smaller package is Apache licensed and contains less dependencies to pull in when configuring compared to go get github.com/cockroachdb/cockroach.

A README of usage of the parser library can be found here.

The SHA this is based off is available in version.

Versioning

Versioning is done by CockroachDB version, with a v0. prepended. For example, v0.22.1.0.x.y maps to v22.1.0 in CockroachDB, where .x.y maps to any subiterations.

Custom patches

There are custom patches in patches/ which gets applied to the repo. This helps us customise the parser slightly for third party users.

Example usage

import (
  ...
	"github.com/cockroachdb/cockroachdb-parser/pkg/sql/parser"
  ...
)

func Parse() error {
  ast, err := parser.ParseOne("SELECT 1")
  if err != nil {
    return err
  }
  // Do something with the AST
  _ = ast
}

Generating a snapshot

Ensure the CockroachDB repo is cloned in your $GOPATH, and then type:

./snapshot.sh

Directories

Path Synopsis
pkg
cli/exit
Package exit encapsulates calls to os.Exit to control the production of process exit status codes.
Package exit encapsulates calls to os.Exit to control the production of process exit status codes.
col/coldata
Package coldata exposes utilities for handling columnarized data.
Package coldata exposes utilities for handling columnarized data.
geo
Package geo contains the base types for spatial data type operations.
Package geo contains the base types for spatial data type operations.
geo/geoprojbase
Package geoprojbase is a minimal dependency package that contains basic metadata and data structures for SRIDs and their CRS transformations.
Package geoprojbase is a minimal dependency package that contains basic metadata and data structures for SRIDs and their CRS transformations.
geo/geoprojbase/embeddedproj
Package embeddedproj defines the format used to embed static projection data in the Cockroach binary.
Package embeddedproj defines the format used to embed static projection data in the Cockroach binary.
kv/kvserver/concurrency/isolation
Package isolation provides type definitions for isolation level-related concepts used by concurrency control in the key-value layer.
Package isolation provides type definitions for isolation level-related concepts used by concurrency control in the key-value layer.
sql/lexbase
Package lexbase contains utilities for lexing sql.
Package lexbase contains utilities for lexing sql.
sql/lexbase/allkeywords
all-keywords generates sql/lexbase/keywords.go from sql.y.
all-keywords generates sql/lexbase/keywords.go from sql.y.
sql/oidext
Package oidext contains oids that are not in `github.com/lib/pq/oid` as they are not shipped by default with postgres.
Package oidext contains oids that are not in `github.com/lib/pq/oid` as they are not shipped by default with postgres.
sql/parser
Package parser contains exposes a SQL parser for cockroach.
Package parser contains exposes a SQL parser for cockroach.
sql/pgrepl/lsn
Package lsn contains logic for handling the pg_lsn type.
Package lsn contains logic for handling the pg_lsn type.
sql/pgwire/pgcode
Package pgcode defines the PostgreSQL 5-character support codes used throughout the CockroachDB source tree.
Package pgcode defines the PostgreSQL 5-character support codes used throughout the CockroachDB source tree.
sql/privilege
Package privilege outlines the basic privilege system for cockroach.
Package privilege outlines the basic privilege system for cockroach.
sql/sem/builtins/builtinsregistry
Package builtinsregistry stores the definitions of builtin functions.
Package builtinsregistry stores the definitions of builtin functions.
sql/sem/cast
Package cast defines the semantically allowed casts and their information.
Package cast defines the semantically allowed casts and their information.
sql/sem/catid
Package catid is a low-level package exporting ID types.
Package catid is a low-level package exporting ID types.
sql/sem/tree
Code generated by eval_gen.go.
Code generated by eval_gen.go.
sql/sem/tree/evalgen
Command evalgen is used to generate interfaces and "visitor" methods for expr and op evaluation.
Command evalgen is used to generate interfaces and "visitor" methods for expr and op evaluation.
sql/sem/tree/treebin
Package treebin contains the implementation-agnostic information about all binary operators that we support.
Package treebin contains the implementation-agnostic information about all binary operators that we support.
sql/sem/tree/treecmp
Package treecmp contains the implementation-agnostic information about all comparison operators that we support.
Package treecmp contains the implementation-agnostic information about all comparison operators that we support.
sql/sem/tree/treewindow
Package treewindow contains some constants describing window-function specific options.
Package treewindow contains some constants describing window-function specific options.
util/admission/admissionpb
Package admissionpb contains the base types for the admission package.
Package admissionpb contains the base types for the admission package.
util/buildutil
Package buildutil provides a constant CrdbTestBuild.
Package buildutil provides a constant CrdbTestBuild.
util/encoding
Package encoding exposes some utilities for encoding data as bytes.
Package encoding exposes some utilities for encoding data as bytes.
util/grunning
Package grunning is a library that's able to retrieve on-CPU running time for individual goroutines.
Package grunning is a library that's able to retrieve on-CPU running time for individual goroutines.
util/interval
Package interval provides two implementations for an interval tree.
Package interval provides two implementations for an interval tree.
util/pretty
Package pretty prints documents based on a target line width.
Package pretty prints documents based on a target line width.
util/timeutil/gen
This binary takes the tzdata from Go's source and extracts all timezones names from them.
This binary takes the tzdata from Go's source and extracts all timezones names from them.
util/timeutil/pgdate
Package pgdate contains parsing functions and types for dates and times in a manner that is compatible with PostgreSQL.
Package pgdate contains parsing functions and types for dates and times in a manner that is compatible with PostgreSQL.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL