fixed typos and some linter suggestions
This commit is contained in:
+9
-9
@@ -18,7 +18,7 @@ func New(db dbx.Builder) *Dao {
|
||||
return NewMultiDB(db, db)
|
||||
}
|
||||
|
||||
// New creates a new Dao instance with the provided dedicated
|
||||
// NewMultiDB creates a new Dao instance with the provided dedicated
|
||||
// async and sync db builders.
|
||||
func NewMultiDB(concurrentDB, nonconcurrentDB dbx.Builder) *Dao {
|
||||
return &Dao{
|
||||
@@ -87,16 +87,16 @@ func (dao *Dao) Clone() *Dao {
|
||||
// WithoutHooks returns a new Dao with the same configuration options
|
||||
// as the current one, but without create/update/delete hooks.
|
||||
func (dao *Dao) WithoutHooks() *Dao {
|
||||
new := dao.Clone()
|
||||
clone := dao.Clone()
|
||||
|
||||
new.BeforeCreateFunc = nil
|
||||
new.AfterCreateFunc = nil
|
||||
new.BeforeUpdateFunc = nil
|
||||
new.AfterUpdateFunc = nil
|
||||
new.BeforeDeleteFunc = nil
|
||||
new.AfterDeleteFunc = nil
|
||||
clone.BeforeCreateFunc = nil
|
||||
clone.AfterCreateFunc = nil
|
||||
clone.BeforeUpdateFunc = nil
|
||||
clone.AfterUpdateFunc = nil
|
||||
clone.BeforeDeleteFunc = nil
|
||||
clone.AfterDeleteFunc = nil
|
||||
|
||||
return new
|
||||
return clone
|
||||
}
|
||||
|
||||
// ModelQuery creates a new preconfigured select query with preset
|
||||
|
||||
+5
-5
@@ -162,8 +162,8 @@ func (dao *Dao) DeleteCollection(collection *models.Collection) error {
|
||||
// SaveCollection persists the provided Collection model and updates
|
||||
// its related records table schema.
|
||||
//
|
||||
// If collecction.IsNew() is true, the method will perform a create, otherwise an update.
|
||||
// To explicitly mark a collection for update you can use collecction.MarkAsNotNew().
|
||||
// If collection.IsNew() is true, the method will perform a create, otherwise an update.
|
||||
// To explicitly mark a collection for update you can use collection.MarkAsNotNew().
|
||||
func (dao *Dao) SaveCollection(collection *models.Collection) error {
|
||||
var oldCollection *models.Collection
|
||||
|
||||
@@ -263,11 +263,11 @@ func (dao *Dao) ImportCollections(
|
||||
|
||||
// extend existing schema
|
||||
if !deleteMissing {
|
||||
schema, _ := existing.Schema.Clone()
|
||||
schemaClone, _ := existing.Schema.Clone()
|
||||
for _, f := range imported.Schema.Fields() {
|
||||
schema.AddField(f) // add or replace
|
||||
schemaClone.AddField(f) // add or replace
|
||||
}
|
||||
imported.Schema = *schema
|
||||
imported.Schema = *schemaClone
|
||||
}
|
||||
} else {
|
||||
imported.MarkAsNew()
|
||||
|
||||
Reference in New Issue
Block a user