From 2ac4afd7d5a7b05e7ab00e794340479696996bcd Mon Sep 17 00:00:00 2001 From: Jeremy Stone Date: Tue, 8 Mar 2022 08:31:18 -0700 Subject: [PATCH] update documentation with examples of non-persisted fields --- README.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index cef8534..1fe310a 100644 --- a/README.md +++ b/README.md @@ -53,11 +53,13 @@ var personTable = table.New(personMetadata) // Person represents a row in person table. // Field names are converted to camel case by default, no need to add special tags. -// If you want to disable a field add `db:"-"` tag, it will not be persisted. +// A field will not be persisted by adding the `db:"-"` tag or making it unexported. type Person struct { FirstName string LastName string Email []string + HairColor string `db:"-"` // exported and skipped + eyeColor string // unexported also skipped } ``` @@ -68,6 +70,8 @@ p := Person{ "MichaƂ", "Matczuk", []string{"michal@scylladb.com"}, + "red", // not persisted + "hazel" // not persisted } q := session.Query(personTable.Insert()).BindStruct(p) if err := q.ExecRelease(); err != nil {