(ctx context.Context, target string, key string)
| 94 | } |
| 95 | |
| 96 | func (i *imlCommitService[T]) Latest(ctx context.Context, target string, key string) (*Commit[T], error) { |
| 97 | list, err := i.store.Latest(ctx, key, target) |
| 98 | if err != nil { |
| 99 | return nil, err |
| 100 | } |
| 101 | if len(list) == 0 { |
| 102 | return nil, gorm.ErrRecordNotFound |
| 103 | } |
| 104 | result := list[0] |
| 105 | return newCommit(result), nil |
| 106 | } |
| 107 | |
| 108 | func (i *imlCommitService[T]) Save(ctx context.Context, target string, key string, data *T) error { |
| 109 | return i.store.Save(ctx, key, target, data) |