This PR adds the sqlair.go file. This file contains all the public methods that will be exposed as the library API.
It also contains PR #42.
The public interface contains a Statement, a DB and a Query type. The statement represents a prepared SQLair statement. The DB is a database that can execute queries that include SQLair DML and the Query represents the query and iterates over the results.
Following the spec we use a pattern of iteration over the Query where errors are not immediately returned. Instead, Next and Decode return a boolean and if an error is encountered. The error can then be checked with Query.Err().
Close must be called once iteration over the rows has finished. It is called implicitly if Next or Decode return false.
This PR adds the
sqlair.go
file. This file contains all the public methods that will be exposed as the library API.It also contains PR #42.
The public interface contains a
Statement
, aDB
and aQuery
type. The statement represents a prepared SQLair statement. TheDB
is a database that can execute queries that include SQLair DML and theQuery
represents the query and iterates over the results.Following the spec we use a pattern of iteration over the
Query
where errors are not immediately returned. Instead,Next
andDecode
return a boolean and if an error is encountered. The error can then be checked withQuery.Err()
.Close
must be called once iteration over the rows has finished. It is called implicitly ifNext
orDecode
return false.