From 412e7ed1e670c4683b6461c56f7e812cf8b6b3de Mon Sep 17 00:00:00 2001 From: Jim Date: Mon, 25 Sep 2023 16:30:31 -0700 Subject: [PATCH] docs: fix a few string quoting bits (#27) --- README.md | 2 +- docs.go | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0e24b9c..83e71c3 100644 --- a/README.md +++ b/README.md @@ -70,7 +70,7 @@ See [GRAMMAR.md](./GRAMMAR.md) for a more complete documentation of [mql](https: Example query: -`name="alice" and age > 11 and (region % Boston or region="south shore")` +`name="alice" and age > 11 and (region % 'Boston' or region="south shore")` ### Date/Time fields diff --git a/docs.go b/docs.go index a0054df..c347670 100644 --- a/docs.go +++ b/docs.go @@ -9,7 +9,7 @@ // // Gorm: https://github.com/go-gorm/gorm // -// w, err := mql.Parse("name=alice or name=bob)",User{}) +// w, err := mql.Parse(`name="alice" or name="bob"`,User{}) // if err != nil { // return nil, err // } @@ -17,7 +17,7 @@ // // database/sql: https://pkg.go.dev/database/sql // -// w, err := mql.Parse("name=alice or name=bob)",User{}) +// w, err := mql.Parse(`name="alice" or name="bob"`,User{}) // if err != nil { // return nil, err // } @@ -26,7 +26,7 @@ // // go-dbw: https://github.com/hashicorp/go-dbw // -// w, err := mql.Parse("name=alice or name=bob)",User{}) +// w, err := mql.Parse(`name="alice" or name="bob")`,User{}) // if err != nil { // return nil, err // } @@ -41,7 +41,9 @@ // Fields in your model can be compared with the following operators: // =, !=, >=, <=, <, >, % // -// Double quotes `"` can be used to quote strings. +// Strings must be quoted. Double quotes ", single quotes ' or backticks ` can +// be used as delimiters. Users can choose whichever supported delimiter makes +// it easier to quote their string. // // Comparison operators can have optional leading/trailing whitespace. // @@ -58,5 +60,5 @@ // // Example query: // -// name=alice and age > 11 and (region % Boston or region="south shore") +// name="alice" and age > 11 and (region % "Boston" or region="south shore") package mql