package
1.1.24
Repository: https://github.com/moranilt/http-utils.git
Documentation: pkg.go.dev

# README

Query Builder

Simple query builder for SQL.

Example

  query := New("SELECT * FROM test_table").LeftJoin("test_posts", "test_table.id=test_posts.user_id").Order("name", DESC).Limit("5").Offset("1")
  query.Where().
    OR(EQ("name", "testname"), EQ("age", "12")).
    AND(EQ("id", "123"), EQ("email", "[email protected]")).
    LIKE("name", "%testname")
  fmt.Println(query.String())
  // Output: SELECT * FROM test_table LEFT JOIN test_posts ON test_table.id=test_posts.user_id WHERE (name='testname' OR age='12') AND (id='123' AND email='[email protected]') AND name LIKE '%testname' ORDER BY name DESC LIMIT 5 OFFSET 1

# Functions

AND creates an AND condition string from the provided arguments.
EQ creates an equality condition string.
IN creates an IN condition string from the provided field name and values.
IS creates an IS condition string from the provided arguments.
LIKE creates a LIKE condition string.
New creates a new Query with the given base SQL query string.
OR creates an OR condition string from the provided arguments.
ValidOrderType checks if the given string is a valid ordering type.

# Constants

ASC is ascending order.
DESC is descending order.

# Structs

No description provided by the author

# Interfaces

No description provided by the author