Documentation
¶
Index ¶
- Constants
- func NewMigration(driverName, dataSourceName string) *migration
- type Basis
- type Db
- type Format
- type Index
- type IndexQuery
- type IndexRecord
- type IndexRecordID
- type IndexRecordQuery
- type ModelTx
- type QueryResult
- type SearchQuery
- type SearchQueryResultItem
- type SqlTestSuite
- type Tags
- type Tx
- type Vector
Constants ¶
View Source
const ( PqForeignKeyViolationError = pq.ErrorCode("23503") PqUniqueViolationError = pq.ErrorCode("23505") )
Variables ¶
This section is empty.
Functions ¶
func NewMigration ¶
func NewMigration(driverName, dataSourceName string) *migration
Types ¶
type Basis ¶ added in v0.5.0
type Basis json.RawMessage
type Db ¶
type Db interface {
// NewModelTx creates new ModelTx object
NewModelTx(ctx context.Context) ModelTx
// NewTx creates Tx object
NewTx(ctx context.Context) Tx
}
Db interface exposes
type IndexQuery ¶ added in v0.4.0
type IndexRecord ¶ added in v0.0.2
type IndexRecordID ¶ added in v0.11.0
type IndexRecordQuery ¶ added in v0.4.0
type ModelTx ¶
type ModelTx interface {
Tx
// CreateFormat creates format entry
CreateFormat(format Format) (string, error)
// GetFormat retrieves format entry by name
GetFormat(name string) (Format, error)
// DeleteFormat deletes format entry by name (only if not referenced)
DeleteFormat(name string) error
// ListFormats lists all the existing format entries
ListFormats() ([]Format, error)
// CreateIndex creates index entry based on source ID
CreateIndex(index Index) (Index, error)
// GetIndex retrieves index info by ID
GetIndex(ID string) (Index, error)
// UpdateIndex updates index info
UpdateIndex(index Index) error
// DeleteIndex deletes index entry and all the related records
DeleteIndex(ID string) error
// QueryIndexes lists query matching index entries
QueryIndexes(query IndexQuery) (QueryResult[Index, string], error)
// CreateIndexRecords creates index records entries
CreateIndexRecords(records ...IndexRecord) error
// GetIndexRecord retrieves index record entry by ID
GetIndexRecord(ID string) (IndexRecord, error)
// UpdateIndexRecord updates index record
UpdateIndexRecord(record IndexRecord) error
// DeleteIndexRecords deletes index records by IDs
DeleteIndexRecords(ID ...string) error
// QueryIndexRecords lists query matching index record entries
QueryIndexRecords(query IndexRecordQuery) (QueryResult[IndexRecord, string], error)
// Search performs full text search across existing index records
// the query string should be formed in accordance with the groonga manual
// for the `&@~` operator, useful links:
// - https://pgroonga.github.io/reference/operators/query-v2.html
// - https://groonga.org/docs/reference/grn_expr/query_syntax.html
Search(query SearchQuery) (QueryResult[SearchQueryResultItem, string], error)
}
ModelTx provides a transaction with some methods for accessing to the Model objects
type QueryResult ¶
type SearchQuery ¶ added in v0.7.0
type SearchQueryResultItem ¶ added in v0.7.0
type SearchQueryResultItem struct {
IndexRecord
Score int
}
type SqlTestSuite ¶
SqlTestSuite struct used to wrap all related database connection stuff into one suite
func (*SqlTestSuite) AfterTest ¶
func (s *SqlTestSuite) AfterTest(suiteName, testName string)
func (*SqlTestSuite) BeforeTest ¶
func (s *SqlTestSuite) BeforeTest(suiteName, testName string)
func (*SqlTestSuite) GetDb ¶
func (s *SqlTestSuite) GetDb() Db
func (*SqlTestSuite) SetupSuite ¶
func (s *SqlTestSuite) SetupSuite()
func (*SqlTestSuite) TearDownSuite ¶
func (s *SqlTestSuite) TearDownSuite()
type Tx ¶
type Tx interface {
// MustBegin starts the transaction
MustBegin()
// MustBeginSerializable starts new transaction with Serializable isolation level
MustBeginSerializable()
// Commit commits the changes made within the transaction
Commit() error
// Rollback rolls the transaction back
Rollback() error
// ExecScript allows to execute the sql statements from the file provided
ExecScript(sqlScript string) error
}
Tx interface describes an abstract DB transaction.
type Vector ¶ added in v0.5.0
type Vector json.RawMessage
Click to show internal directories.
Click to hide internal directories.