Documentation ¶
Index ¶
- Constants
- Variables
- func CommitMigration(cfg *common.Config, inMemorySource *InMemorySource, steps int) error
- type DB
- type InMemorySource
- func (s *InMemorySource) Close() error
- func (s *InMemorySource) First() (uint, error)
- func (s *InMemorySource) Next(version uint) (uint, error)
- func (s *InMemorySource) Open(url string) (source.Driver, error)
- func (s *InMemorySource) Prev(version uint) (uint, error)
- func (s *InMemorySource) ReadDown(version uint) (io.ReadCloser, string, error)
- func (s *InMemorySource) ReadUp(version uint) (io.ReadCloser, string, error)
- type MindPalaceDB
- func (m *MindPalaceDB) Close() error
- func (m *MindPalaceDB) ConstructSchema(user string) string
- func (m *MindPalaceDB) CreateSchema(user string) (string, error)
- func (m *MindPalaceDB) CurrentSchema() string
- func (m *MindPalaceDB) DB() *sql.DB
- func (m *MindPalaceDB) ListMPSchemas() ([]string, error)
- func (m *MindPalaceDB) Ping(ctx context.Context) error
- func (m *MindPalaceDB) Query(query string, args ...any) (SQLRows, error)
- func (m *MindPalaceDB) SetSchema(schema string)
- type MockDB
- type MockRows
- func (rows *MockRows) Close() error
- func (rows *MockRows) ColumnTypes() ([]*sql.ColumnType, error)
- func (rows *MockRows) Columns() ([]string, error)
- func (rows *MockRows) Err() error
- func (rows *MockRows) Next() bool
- func (rows *MockRows) NextResultSet() bool
- func (rows *MockRows) Scan(dest ...interface{}) error
- type MultiInstruction
- func (t *MultiInstruction) Begin() error
- func (t *MultiInstruction) BeginTx(ctx context.Context) error
- func (t *MultiInstruction) Commit(ctx context.Context) error
- func (t *MultiInstruction) CurrentSchema() string
- func (t *MultiInstruction) Exec(ctx context.Context, query string, args ...interface{}) error
- func (t *MultiInstruction) Prepare(ctx context.Context, query string) (*sql.Stmt, error)
- func (t *MultiInstruction) Query(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error)
- func (t *MultiInstruction) QueryRow(ctx context.Context, query string, args ...interface{}) *sql.Row
- func (t *MultiInstruction) Rollback(ctx context.Context) error
- type SQLRows
Constants ¶
View Source
const RETRY_COUNT = 3
Variables ¶
View Source
var Table = table{
Chunk: "chunk",
ChunkKeyword: "chunk_keyword",
Keyword: "keyword",
MemoryKeyword: "memory_keyword",
Memory: "memory",
OriginalResource: "original_resource",
Summary: "summary",
}
Functions ¶
func CommitMigration ¶
func CommitMigration(cfg *common.Config, inMemorySource *InMemorySource, steps int) error
Types ¶
type InMemorySource ¶
type InMemorySource struct {
Migrations *source.Migrations
}
func Down ¶
func Down(cfg *common.Config, sqlTemplates []common.SQLTemplate) *InMemorySource
func NewInMemorySource ¶
func NewInMemorySource() *InMemorySource
func Up ¶
func Up(cfg *common.Config, sqlTemplates []common.SQLTemplate) (*InMemorySource, int)
TODO: when ups (steps) exceeds total number of migrations (or total steps - last migration version), calculate the difference and apply
func (*InMemorySource) Close ¶
func (s *InMemorySource) Close() error
func (*InMemorySource) First ¶
func (s *InMemorySource) First() (uint, error)
func (*InMemorySource) ReadDown ¶
func (s *InMemorySource) ReadDown(version uint) (io.ReadCloser, string, error)
func (*InMemorySource) ReadUp ¶
func (s *InMemorySource) ReadUp(version uint) (io.ReadCloser, string, error)
type MindPalaceDB ¶
type MindPalaceDB struct { ConnectionString string // contains filtered or unexported fields }
func InitDB ¶
func InitDB(cfg *common.Config) *MindPalaceDB
func (*MindPalaceDB) Close ¶
func (m *MindPalaceDB) Close() error
func (*MindPalaceDB) ConstructSchema ¶
func (m *MindPalaceDB) ConstructSchema(user string) string
func (*MindPalaceDB) CreateSchema ¶
func (m *MindPalaceDB) CreateSchema(user string) (string, error)
func (*MindPalaceDB) CurrentSchema ¶
func (m *MindPalaceDB) CurrentSchema() string
func (*MindPalaceDB) DB ¶
func (m *MindPalaceDB) DB() *sql.DB
func (*MindPalaceDB) ListMPSchemas ¶
func (m *MindPalaceDB) ListMPSchemas() ([]string, error)
func (*MindPalaceDB) Query ¶
func (m *MindPalaceDB) Query(query string, args ...any) (SQLRows, error)
func (*MindPalaceDB) SetSchema ¶
func (m *MindPalaceDB) SetSchema(schema string)
type MockDB ¶
func (*MockDB) CurrentSchema ¶
type MockRows ¶
Mocking the database rows
func (*MockRows) ColumnTypes ¶
func (rows *MockRows) ColumnTypes() ([]*sql.ColumnType, error)
func (*MockRows) NextResultSet ¶
type MultiInstruction ¶
func NewMultiInstruction ¶
func NewMultiInstruction(db *MindPalaceDB) *MultiInstruction
func (*MultiInstruction) Begin ¶
func (t *MultiInstruction) Begin() error
func (*MultiInstruction) CurrentSchema ¶
func (t *MultiInstruction) CurrentSchema() string
func (*MultiInstruction) Exec ¶
func (t *MultiInstruction) Exec(ctx context.Context, query string, args ...interface{}) error
Click to show internal directories.
Click to hide internal directories.