redblocks-go

This package is still under development.

This package is Go implemntation of Altech/red_blocks.

CircleCI codecov

install

go get -u github.com/rerost/redblocks-go

Example

func NewRegionSet(region string) set.Set {
	return regionSetImp{region}
}

type regionSetImp struct {
	region string
}

func (r regionSetImp) KeySuffix() string {
	return r.region
}

func (r regionSetImp) Get(ctx context.Context) ([]set.IDWithScore, error) {
  ...
}

func (r regionSetImp) CacheTime() time.Duration {
	return time.Second * 10
}

store := store.NewRedisStore(newPool())
tokyo := compose.Compose(NewRegionSet("tokyo"), store)
osaka := compose.Compose(NewRegionSet("osaka"), store)

set := operator.NewIntersecionSet(store, time.Second*100, tokyo, osaka)
set.IDs(ctx, options.WithPagenation(0, -1))

Full version