tsvector

package module
v0.0.0-...-6136614 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 27, 2023 License: MIT Imports: 10 Imported by: 0

README

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)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type TSVector

type TSVector struct {
	// contains filtered or unexported fields
}

func ToTSVector

func ToTSVector(args ...string) TSVector

func (TSVector) GormDataType

func (tsv TSVector) GormDataType() string

func (TSVector) GormValue

func (tsv TSVector) GormValue(ctx context.Context, db *gorm.DB) clause.Expr

func (TSVector) Lexemes

func (tsv TSVector) Lexemes() map[string][]int

func (*TSVector) Scan

func (tsv *TSVector) Scan(v interface{}) error

func (*TSVector) UnmarshalJSON

func (tsv *TSVector) UnmarshalJSON(data []byte) error

func (TSVector) Value

func (tsv TSVector) Value() (driver.Value, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL