Skip to content

Instantly share code, notes, and snippets.

@agusrichard
Created June 6, 2021 21:40
Show Gist options
  • Select an option

  • Save agusrichard/a3cd2a4eadd81125a2beccf288113825 to your computer and use it in GitHub Desktop.

Select an option

Save agusrichard/a3cd2a4eadd81125a2beccf288113825 to your computer and use it in GitHub Desktop.
type tweetRepository struct {
db *sqlx.DB
}
type TweetRepository interface {
CreateTweet(tweet *entities.Tweet) error
// ... another methods for tweet repository
}
func InitializeTweetRepository(db *sqlx.DB) TweetRepository {
return &tweetRepository{db}
}
func (repository *tweetRepository) CreateTweet(tweet *entities.Tweet) error {
// ... some insert operation detail here
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment