MCPcopy Create free account
hub / github.com/apache/devlake / unwrapDynamic

Method unwrapDynamic

backend/impls/dalgorm/dalgorm.go:158–173  ·  view source on GitHub ↗
(entityPtr *interface{}, clausesPtr *[]dal.Clause)

Source from the content-addressed store, hash-verified

156}
157
158func (d *Dalgorm) unwrapDynamic(entityPtr *interface{}, clausesPtr *[]dal.Clause) {
159 if dynamic, ok := (*entityPtr).(models.DynamicTabler); ok {
160 if clausesPtr != nil {
161 *clausesPtr = append(*clausesPtr, dal.From(dynamic.TableName()))
162 }
163 *entityPtr = dynamic.Unwrap()
164 } else if clausesPtr != nil {
165 // try to add dal.From if it does not exist
166 for _, c := range *clausesPtr {
167 if c.Type == dal.FromClause {
168 return
169 }
170 }
171 *clausesPtr = append(*clausesPtr, dal.From(*entityPtr))
172 }
173}
174
175// AutoMigrate runs auto migration for given models
176func (d *Dalgorm) AutoMigrate(entity interface{}, clauses ...dal.Clause) errors.Error {

Callers 11

AutoMigrateMethod · 0.95
AllMethod · 0.95
FirstMethod · 0.95
CreateMethod · 0.95
CreateWithMapMethod · 0.95
UpdateMethod · 0.95
CreateOrUpdateMethod · 0.95
CreateIfNotExistMethod · 0.95
DeleteMethod · 0.95
UpdateColumnMethod · 0.95
UpdateColumnsMethod · 0.95

Calls 3

FromMethod · 0.65
TableNameMethod · 0.65
UnwrapMethod · 0.65

Tested by

no test coverage detected