Esempio n. 1
0
func (d *TvRecordDriver) Delete(key *ds.Key) error {
	if err := d.Driver.Delete(key); err != nil {
		d.Logger.Info("Deleted the record: (%s)", key.String()[:8])
		return err
	} else {
		d.Logger.Info("Deleted the record: (%s)", key.String()[:8])
		return nil
	}
}
Esempio n. 2
0
func getPeerMemcacheKey(key *datastore.Key) string {
	return "peers:" + key.String()
}
Esempio n. 3
0
File: acl.go Progetto: gaego/acl
func genID(objKey *datastore.Key, groupId, perm string) string {
	return objKey.String() + "|" + groupId + "|" + strings.ToLower(perm)
}
//TODO finish this function with the popper search parameters
func UserHasActiveSubscription(ctx appengine.Context, userKey *datastore.Key) (bool, error) {

	count, err := datastore.NewQuery(TXN_KIND).
		Ancestor(userKey).
		Filter("PaymentActivationDate>=", time.Now().AddDate(0, -6, 0)).
		Count(ctx)

	if err != nil {
		return false, err
	}

	if count > 1 {
		ctx.Criticalf(fmt.Sprintf("User has multiple (%d) active subscriptions, key: %s", count, userKey.String()))
	}

	return count > 0, nil
}