| 56 | } |
| 57 | |
| 58 | func (association *Association) Append(values ...interface{}) error { |
| 59 | values = expandValues(values) |
| 60 | |
| 61 | if association.Error == nil { |
| 62 | switch association.Relationship.Type { |
| 63 | case schema.HasOne, schema.BelongsTo: |
| 64 | if len(values) > 0 { |
| 65 | association.Error = association.Replace(values...) |
| 66 | } |
| 67 | default: |
| 68 | association.saveAssociation( /*clear*/ false, values...) |
| 69 | } |
| 70 | } |
| 71 | |
| 72 | return association.Error |
| 73 | } |
| 74 | |
| 75 | func (association *Association) Replace(values ...interface{}) error { |
| 76 | values = expandValues(values) |