Documentation ¶
Index ¶
- func FtsQuery(query, prefix string) string
- type ChunkResult
- type DB
- func (p *DB) Chunk(chunkSize int, query string, arg interface{}) (sql.Result, error)
- func (p *DB) ExecAll(queries []string) (err error)
- func (p *DB) NamedGet(dest interface{}, query string, arg interface{}) error
- func (p *DB) NamedSelect(dest interface{}, query string, arg interface{}) error
- func (p *DB) Open() (err error)
- type NullString
- type RedisPool
- type RedisStore
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func FtsQuery ¶
FtsQuery takes a user-generated query string and formats as a query suitable for postgresql's ts_query(). It does its level best to sanitize user input.
Basic Algorithm:
- Split query into fields where fields contain characters conforming to unicode.isLetter() and unicode.isNumber(). All other characters are treated as field separators and discarded.
- Fields which conform to [Prefix][Number] (case insensitive) are striped of the prefix and any leading zeros and used as an alternate to the field. ex: T01001 -> (T01001:* | 1001:*)
- All fields are treated as a prefix search by appending ':*'
- Fields are explicitly ANDed together
- ex: 'hsa01040 fat' -> '(hsa01040:* | 1040:*) & fat:*'
Types ¶
type ChunkResult ¶
type ChunkResult struct {
// contains filtered or unexported fields
}
func (ChunkResult) LastInsertId ¶
func (p ChunkResult) LastInsertId() (int64, error)
LastInsertId foo
func (ChunkResult) RowsAffected ¶
func (p ChunkResult) RowsAffected() (int64, error)
RowsAffected foo
type DB ¶
type DB struct { *sqlx.DB Host string `mapstructure:"host"` Database string `mapstructure:"database"` User string `mapstructure:"user"` Password string `mapstructure:"password"` }
func (*DB) NamedSelect ¶
type NullString ¶
type NullString sql.NullString
func (*NullString) Scan ¶
func (p *NullString) Scan(value interface{}) error
func (*NullString) UnmarshalJSON ¶
func (p *NullString) UnmarshalJSON(data []byte) error
UnmarshalJSON foo
Click to show internal directories.
Click to hide internal directories.