code: func (query Query) Insert(record interface{}, chs ...*changeset.Changeset) error {
  	var err error
  	var ids []interface{}
  
  	if len(chs) == 1 {
  		// single insert
  		ch := chs[0]
  		changes := make(map[string]interface{})
  		cloneChangeset(changes, ch.Changes())
  		putTimestamp(changes, "created_at", ch.Types())
  		putTimestamp(changes, "updated_at", ch.Types())
  		cloneQuery(changes, query.Changes)
  
  		var id interface{}
  		id, err = query.repo.adapter.Insert(query, changes, query.repo.logger...)
  		ids = append(ids, id)
  	} else if len(chs) > 1 {
  		// multiple insert
  		fields := getFields(query, chs)
  
  		allchanges := make([]map[string]interface{}, len(chs))
  		for i, ch := range chs {
  			changes := make(map[string]interface{})
  			cloneChangeset(changes, ch.Changes())
  			putTimestamp(changes, "created_at", ch.Types())
  			putTimestamp(changes, "updated_at", ch.Types())
  			cloneQuery(changes, query.Changes)
  
  			allchanges[i] = changes
  		}
  
  		ids, err = query.repo.adapter.InsertAll(query, fields, allchanges, query.repo.logger...)
  	} else if len(query.Changes) > 0 {
  		// set only
  		var id interface{}
  		id, err = query.repo.adapter.Insert(query, query.Changes, query.repo.logger...)
  		ids = append(ids, id)
  	}
  
  	if err != nil {
  		return transformError(err, chs...)
  	} else if record == nil || len(ids) == 0 {
  		return nil
  	} else if len(ids) == 1 {
  		return transformError(query.Find(ids[0]).One(record))
  	}
  
  	return transformError(query.Where(c.In(c.I("id"), ids...)).All(record))
  }
docs: // Insert records to database.