(ctx context.Context, settings map[string]string)
| 70 | } |
| 71 | |
| 72 | func (r *settingRepository) SetMultiple(ctx context.Context, settings map[string]string) error { |
| 73 | if len(settings) == 0 { |
| 74 | return nil |
| 75 | } |
| 76 | |
| 77 | now := time.Now() |
| 78 | builders := make([]*ent.SettingCreate, 0, len(settings)) |
| 79 | for key, value := range settings { |
| 80 | builders = append(builders, r.client.Setting.Create().SetKey(key).SetValue(value).SetUpdatedAt(now)) |
| 81 | } |
| 82 | return r.client.Setting. |
| 83 | CreateBulk(builders...). |
| 84 | OnConflictColumns(setting.FieldKey). |
| 85 | UpdateNewValues(). |
| 86 | Exec(ctx) |
| 87 | } |
| 88 | |
| 89 | func (r *settingRepository) GetAll(ctx context.Context) (map[string]string, error) { |
| 90 | settings, err := r.client.Setting.Query().All(ctx) |
nothing calls this directly
no test coverage detected