| 1 | package store |
| 2 | |
| 3 | import "example.com/curator/internal/config" |
| 4 | |
| 5 | // ModuleResolver abstracts module lookup for the server. |
| 6 | type ModuleResolver interface { |
| 7 | ResolveModule(name string) (config.Module, bool) |
| 8 | } |
| 9 | |
| 10 | // CredentialResolver abstracts credential lookup. |
| 11 | type CredentialResolver interface { |
| 12 | GetCredential(name string) (CredentialRow, error) |
| 13 | } |
| 14 | |
| 15 | // CredentialRow represents a named credential stored in the database. |
| 16 | type CredentialRow struct { |
| 17 | Name string `json:"name"` |
| 18 | Type string `json:"type"` |
| 19 | Data string `json:"data,omitempty"` |
| 20 | CreatedAt string `json:"created_at,omitempty"` |
| 21 | } |
| 22 | |
| 23 | // ModuleRow represents a module stored in the database. |
| 24 | type ModuleRow struct { |
| 25 | Name string `json:"name"` |
| 26 | VCS string `json:"vcs"` |
| 27 | Repo string `json:"repo"` |
| 28 | Web string `json:"web"` |
| 29 | Private bool `json:"private"` |
| 30 | CredentialName string `json:"credential_name,omitempty"` |
| 31 | CreatedAt string `json:"created_at,omitempty"` |
| 32 | } |
| 33 | |
| 34 | // PatternRow represents a module pattern stored in the database. |
| 35 | type PatternRow struct { |
| 36 | ID int64 `json:"id"` |
| 37 | Pattern string `json:"pattern"` |
| 38 | VCS string `json:"vcs"` |
| 39 | Repo string `json:"repo"` |
| 40 | Web string `json:"web"` |
| 41 | Private bool `json:"private"` |
| 42 | Priority int `json:"priority"` |
| 43 | CredentialName string `json:"credential_name,omitempty"` |
| 44 | CreatedAt string `json:"created_at,omitempty"` |
| 45 | } |
| 46 | |