Documentation
¶
Overview ¶
Copyright 2023 The Simila Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Simila Authors ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Simila Authors ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Simila Authors ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Copyright 2023 The Simila Authors ¶
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
Constants ¶
const (
PqUniqueViolationError = pq.ErrorCode("23505")
)
Variables ¶
This section is empty.
Functions ¶
func NewMigration ¶
func NewMigration(driverName, dataSourceName string) *migration
Types ¶
type Db ¶
type Db interface {
// NewModelTx creates new ModelTx object
NewModelTx() ModelTx
// NewTx creates Tx object
NewTx() Tx
}
db interface exposes
type ModelTx ¶
type ModelTx interface {
Tx
// CreateTestRecord this is a test call, REMOVE it when everything works
CreateTestRecord(t TestRecord) (string, error)
}
ModelTx provides a transaction with some methods for accessing to the Model objects
type QueryResult ¶
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 TestRecord ¶
type TestRecord struct {
ID string `db:"id"`
}
type Tx ¶
type Tx interface {
// MustBegin starts the transaction
MustBegin()
// MustBeginSerializable starts new transaction with Serializable isolation level
MustBeginSerializable(ctx context.Context)
// 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.