mirror of
https://github.com/christianselig/apollo-backend
synced 2024-11-14 16:07:42 +00:00
26 lines
455 B
Go
26 lines
455 B
Go
|
package domain
|
||
|
|
||
|
import (
|
||
|
"context"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
type Subreddit struct {
|
||
|
ID int64
|
||
|
|
||
|
// Reddit information
|
||
|
SubredditID string
|
||
|
Name string
|
||
|
}
|
||
|
|
||
|
func (sr *Subreddit) NormalizedName() string {
|
||
|
return strings.ToLower(sr.Name)
|
||
|
}
|
||
|
|
||
|
type SubredditRepository interface {
|
||
|
GetByID(ctx context.Context, id int64) (Subreddit, error)
|
||
|
GetByName(ctx context.Context, name string) (Subreddit, error)
|
||
|
|
||
|
CreateOrUpdate(ctx context.Context, sr *Subreddit) error
|
||
|
}
|