gopkg.in/rethinkdb/rethinkdb-go.v6@v6.2.2/query_string.go (about)

     1  package rethinkdb
     2  
     3  import (
     4  	p "gopkg.in/rethinkdb/rethinkdb-go.v6/ql2"
     5  )
     6  
     7  // Match matches against a regular expression. If no match is found, returns
     8  // null. If there is a match then an object with the following fields is
     9  // returned:
    10  //   str: The matched string
    11  //   start: The matched string’s start
    12  //   end: The matched string’s end
    13  //   groups: The capture groups defined with parentheses
    14  //
    15  // Accepts RE2 syntax (https://code.google.com/p/re2/wiki/Syntax). You can
    16  // enable case-insensitive matching by prefixing the regular expression with
    17  // (?i). See the linked RE2 documentation for more flags.
    18  //
    19  // The match command does not support backreferences.
    20  func (t Term) Match(args ...interface{}) Term {
    21  	return constructMethodTerm(t, "Match", p.Term_MATCH, args, map[string]interface{}{})
    22  }
    23  
    24  // Split splits a string into substrings. Splits on whitespace when called with no arguments.
    25  // When called with a separator, splits on that separator. When called with a separator
    26  // and a maximum number of splits, splits on that separator at most max_splits times.
    27  // (Can be called with null as the separator if you want to split on whitespace while still
    28  // specifying max_splits.)
    29  //
    30  // Mimics the behavior of Python's string.split in edge cases, except for splitting on the
    31  // empty string, which instead produces an array of single-character strings.
    32  func (t Term) Split(args ...interface{}) Term {
    33  	return constructMethodTerm(t, "Split", p.Term_SPLIT, funcWrapArgs(args), map[string]interface{}{})
    34  }
    35  
    36  // Upcase upper-cases a string.
    37  func (t Term) Upcase(args ...interface{}) Term {
    38  	return constructMethodTerm(t, "Upcase", p.Term_UPCASE, args, map[string]interface{}{})
    39  }
    40  
    41  // Downcase lower-cases a string.
    42  func (t Term) Downcase(args ...interface{}) Term {
    43  	return constructMethodTerm(t, "Downcase", p.Term_DOWNCASE, args, map[string]interface{}{})
    44  }