mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-11 10:54:28 +00:00
bump micro
This commit is contained in:
@@ -15,7 +15,7 @@ import (
|
||||
|
||||
func (e *Feeds) fetchAll() {
|
||||
fs := []*feeds.Feed{}
|
||||
err := e.feeds.List(e.feedsNameIndex.ToQuery(nil), &fs)
|
||||
err := e.feeds.Read(e.feedsNameIndex.ToQuery(nil), &fs)
|
||||
if err != nil {
|
||||
log.Errorf("Error listing feeds: %v", err)
|
||||
return
|
||||
@@ -42,7 +42,7 @@ func (e *Feeds) fetch(url string) error {
|
||||
|
||||
for _, item := range fd.Items {
|
||||
id := fmt.Sprintf("%x", md5.Sum([]byte(item.ID)))
|
||||
err = e.entries.Save(feeds.Entry{
|
||||
err = e.entries.Create(feeds.Entry{
|
||||
Id: id,
|
||||
Url: item.Link,
|
||||
Title: item.Title,
|
||||
|
||||
@@ -4,9 +4,8 @@ import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"github.com/micro/dev/model"
|
||||
log "github.com/micro/micro/v3/service/logger"
|
||||
"github.com/micro/micro/v3/service/store"
|
||||
"github.com/micro/micro/v3/service/model"
|
||||
|
||||
feeds "github.com/micro/services/feeds/proto"
|
||||
posts "github.com/micro/services/posts/proto"
|
||||
@@ -38,22 +37,13 @@ func NewFeeds(postsService posts.PostsService) *Feeds {
|
||||
entriesURLIndex.Order.FieldName = "date"
|
||||
|
||||
f := &Feeds{
|
||||
feeds: model.New(
|
||||
store.DefaultStore,
|
||||
"feeds",
|
||||
model.Indexes(nameIndex),
|
||||
&model.ModelOptions{
|
||||
Debug: false,
|
||||
IdIndex: idIndex,
|
||||
},
|
||||
feeds: model.NewModel(
|
||||
model.WithNamespace("feeds"),
|
||||
model.WithIndexes(nameIndex),
|
||||
),
|
||||
entries: model.New(
|
||||
store.DefaultStore,
|
||||
"entries",
|
||||
model.Indexes(dateIndex, entriesURLIndex),
|
||||
&model.ModelOptions{
|
||||
Debug: false,
|
||||
},
|
||||
entries: model.NewModel(
|
||||
model.WithNamespace("entries"),
|
||||
model.WithIndexes(dateIndex, entriesURLIndex),
|
||||
),
|
||||
postsService: postsService,
|
||||
feedsIdIndex: idIndex,
|
||||
@@ -76,7 +66,7 @@ func (e *Feeds) crawl() {
|
||||
|
||||
func (e *Feeds) New(ctx context.Context, req *feeds.NewRequest, rsp *feeds.NewResponse) error {
|
||||
log.Info("Received Feeds.New request")
|
||||
e.feeds.Save(feeds.Feed{
|
||||
e.feeds.Create(feeds.Feed{
|
||||
Name: req.Name,
|
||||
Url: req.Url,
|
||||
})
|
||||
@@ -89,5 +79,5 @@ func (e *Feeds) Entries(ctx context.Context, req *feeds.EntriesRequest, rsp *fee
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return e.entries.List(e.entriesURLIndex.ToQuery(req.Url), &rsp.Entries)
|
||||
return e.entries.Read(e.entriesURLIndex.ToQuery(req.Url), &rsp.Entries)
|
||||
}
|
||||
|
||||
2
go.mod
2
go.mod
@@ -10,7 +10,7 @@ require (
|
||||
github.com/gosimple/slug v1.9.0
|
||||
github.com/hailocab/go-geoindex v0.0.0-20160127134810-64631bfe9711
|
||||
github.com/micro/dev v0.0.0-20201117163752-d3cfc9788dfa
|
||||
github.com/micro/micro/v3 v3.0.5-0.20201219085254-c8ea24387d19
|
||||
github.com/micro/micro/v3 v3.0.5-0.20210127104758-0b759ad942a4
|
||||
github.com/miekg/dns v1.1.31 // indirect
|
||||
github.com/stoewer/go-strcase v1.2.0
|
||||
github.com/stretchr/testify v1.6.1
|
||||
|
||||
5
go.sum
5
go.sum
@@ -333,9 +333,13 @@ github.com/mattn/go-tty v0.0.0-20180219170247-931426f7535a/go.mod h1:XPvLUNfbS4f
|
||||
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
|
||||
github.com/micro/dev v0.0.0-20201117163752-d3cfc9788dfa h1:1BoFPE4/NTF7WKLZWsEFImOsN143QAU7Dkw9J2/qFXA=
|
||||
github.com/micro/dev v0.0.0-20201117163752-d3cfc9788dfa/go.mod h1:j/8E+ezN/ij7a9BXBHMKmLayFfUW1O4h/Owdv67B0X0=
|
||||
github.com/micro/micro v1.18.0 h1:v+xiQOXbT9xxotLwu1nJM81t4FbruBxZSSyIdhUfujM=
|
||||
github.com/micro/micro/v3 v3.0.0-beta.6.0.20201016094841-ca8ffd563b2b/go.mod h1:RPJTp9meQAppzW/9jgQtfJmPpRJAySVPbz9uur4B3Ko=
|
||||
github.com/micro/micro/v3 v3.0.4 h1:GupR5YoV0A7hn6C9taD49voZyTyVQT/ihqtGDg867c0=
|
||||
github.com/micro/micro/v3 v3.0.5-0.20201219085254-c8ea24387d19 h1:EtYX0x8UgndRyr1NbxOhbYDublbLYolGxftMv5QlAoY=
|
||||
github.com/micro/micro/v3 v3.0.5-0.20201219085254-c8ea24387d19/go.mod h1:dZa1KcK6Uh9ny7nhgHxOvoPiZR5cAnZefYT+EMmGwp4=
|
||||
github.com/micro/micro/v3 v3.0.5-0.20210127104758-0b759ad942a4 h1:RsLuIC27lqUiloWPitvRbJjkBuVNAkUsNSj6vJiacJI=
|
||||
github.com/micro/micro/v3 v3.0.5-0.20210127104758-0b759ad942a4/go.mod h1:+WoC+lHuRy8FIgJlNuLkhpmsFbylYb0vYcEgMpKT4Z4=
|
||||
github.com/miekg/dns v1.1.15/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg=
|
||||
github.com/miekg/dns v1.1.27/go.mod h1:KNUDUusw/aVsxyTYZM1oqvCicbwhgbNgztCETuNZ7xM=
|
||||
github.com/miekg/dns v1.1.31 h1:sJFOl9BgwbYAWOGEwr61FU28pqsBNdpRBnhGXtO06Oo=
|
||||
@@ -435,6 +439,7 @@ github.com/stoewer/go-strcase v1.2.0 h1:Z2iHWqGXH00XYgqDmNgQbIBxf3wrNq0F3feEy0ai
|
||||
github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48=
|
||||
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
|
||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
||||
|
||||
@@ -71,7 +71,7 @@ func (m *Messages) List(ctx context.Context, req *pb.ListRequest, rsp *pb.ListRe
|
||||
|
||||
// query the store for any messages sent to the user
|
||||
prefix := strings.Join([]string{messagePrefix, req.User}, joinKey)
|
||||
recs, err := store.Read("", store.Prefix(prefix))
|
||||
recs, err := store.Read(prefix, store.ReadPrefix())
|
||||
if err != nil {
|
||||
return errors.BadRequest("messages.List.Unknown", "Error reading from the store")
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ type handler struct{}
|
||||
// List all the notes
|
||||
func (h *handler) List(ctx context.Context, req *pb.ListRequest, rsp *pb.ListResponse) error {
|
||||
// query the store
|
||||
recs, err := store.Read("", store.Prefix(storePrefix))
|
||||
recs, err := store.Read(storePrefix, store.ReadPrefix())
|
||||
if err != nil {
|
||||
logger.Errorf("Error reading notes from the store: %v", err)
|
||||
return errors.InternalServerError("notes.List.Unknown", "Error reading from the store")
|
||||
|
||||
@@ -77,7 +77,7 @@ func (t *Tags) Add(ctx context.Context, req *proto.AddRequest, rsp *proto.AddRes
|
||||
|
||||
oldTagCount := tag.Count
|
||||
// get tag count
|
||||
recs, err := store.List(store.Prefix(fmt.Sprintf("%v:%v", tagCountPrefix, tag.Slug)), store.Limit(1000))
|
||||
recs, err := store.List(store.ListPrefix(fmt.Sprintf("%v:%v", tagCountPrefix, tag.Slug)), store.ListLimit(1000))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -138,7 +138,7 @@ func (t *Tags) Remove(ctx context.Context, req *proto.RemoveRequest, rsp *proto.
|
||||
}
|
||||
|
||||
// get tag count
|
||||
recs, err := store.List(store.Prefix(fmt.Sprintf("%v:%v", tagCountPrefix, tag.Slug)), store.Limit(1000))
|
||||
recs, err := store.List(store.ListPrefix(fmt.Sprintf("%v:%v", tagCountPrefix, tag.Slug)), store.ListLimit(1000))
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -179,7 +179,7 @@ func (t *Tags) List(ctx context.Context, req *proto.ListRequest, rsp *proto.List
|
||||
}
|
||||
return nil
|
||||
}
|
||||
records, err := store.Read("", store.Prefix(key))
|
||||
records, err := store.Read(key, store.ReadPrefix())
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@@ -81,7 +81,7 @@ func (e *Example) TestList(ctx context.Context, req *pb.Request, rsp *pb.Respons
|
||||
}
|
||||
}
|
||||
|
||||
recs, err := store.List(store.Prefix("TestList"))
|
||||
recs, err := store.List(store.ListPrefix("TestList"))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error listing from store %s", err)
|
||||
}
|
||||
@@ -100,7 +100,7 @@ func (e *Example) TestListLimit(ctx context.Context, req *pb.Request, rsp *pb.Re
|
||||
}
|
||||
}
|
||||
|
||||
recs, err := store.List(store.Prefix("TestLimit"), store.Limit(2))
|
||||
recs, err := store.List(store.ListPrefix("TestLimit"), store.ListLimit(2))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error listing from store %s", err)
|
||||
}
|
||||
@@ -119,7 +119,7 @@ func (e *Example) TestListOffset(ctx context.Context, req *pb.Request, rsp *pb.R
|
||||
}
|
||||
}
|
||||
|
||||
recs, err := store.List(store.Prefix("TestOffset"), store.Offset(5))
|
||||
recs, err := store.List(store.ListPrefix("TestOffset"), store.ListOffset(5))
|
||||
if err != nil {
|
||||
return fmt.Errorf("Error listing from store %s", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user