Skip to content
This repository has been archived by the owner on Apr 6, 2023. It is now read-only.

aymericbeaumet/go-tsvector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

go-tsvector

test status github Go.Dev reference

Examples

SQL scan with casting

var out tsvector.TSVector
_ = sqlDB.QueryRow("SELECT $1::tsvector", "The quick brown fox jumps over the lazy dog").Scan(&out)

SQL scan while calling the to_tsvector function

var out tsvector.TSVector
_ = sqlDB.QueryRow("SELECT to_tsvector($1)", "The quick brown fox jumps over the lazy dog").Scan(&out)

Gorm support

type MyModel struct {
	ID  int64             `gorm:"primaryKey"`
	TSV tsvector.TSVector `gorm:"not null"`
}

in := &MyModel{
  TextTSV: tsvector.ToTSVector("The quick brown fox jumps over the lazy dog"),
}
_ = gormDB.Create(in)

var out MyModel
_ = gormDB.First(&out, in.ID)