Dependency Structure of a Go application : **What's the best way to model a model (user) and a database without running into circular dependencies?**

I have a golang application that I'm trying to setup.  The structure of imports is confusing because it doesn't cleanly appear to divide along separation of concerns. I would like to have a database store that requires access to the names of models to migrate them. It seems odd to have models migrate themselves and that seems like a unrelated concern to the models. At the same time, I would like to have validations per model that require the importing of the database store. It seems even more odd to have the store validate individual models. This creates a circular dependency however.

structure:

    models
      - user.go
    config
      - store.go

`store.go`

    ...
    // CreateDb - creates table
    func (i *Store) CreateDb() {
    	...
    	i.DB.AutoMigrate(&models.User{})
        ...
    }
    ...

`user.go`

    package models

    type User struct {
      Email string
    }

    func (u *User) ValidateUser() (err []error) {
    	messages := make([]error, 0)
    
    	// Uniqueness Validations
    	email := ""
    
    	email = config.Database.DB.Where("email LIKE ?", u.Email).First(&User)
    	if email != "" {
    		messages = append(messages, errors.New("Email has to be unique"))

    	}
    
    	return messages
    }


I've tried putting them into a third package but that fails because they both require the same dependency - store.  I've also tried putting them all into the same package which I suppose works but that seems to breakdown all structure and sep of concerns.

Advice?

