Sha256: d2cccbf8785b30186660cd6e64da9dcbc50d98ddd12ccf1d7ae7516a47c158b2
Contents?: true
Size: 713 Bytes
Versions: 10
Compression:
Stored size: 713 Bytes
Contents
<%- import 'context' import model.package import 'google.golang.org/appengine/datastore' import 'google.golang.org/appengine/log' import 'github.com/mjibson/goon' -%> func (s *<%= type.name %>) Exist(ctx context.Context, m *<%= model.qualified_name %>) (bool, error) { if m.ID == 0 { return false, nil } g := goon.FromContext(ctx) key, err := g.KeyError(m) if err != nil { log.Errorf(ctx, "Failed to Get Key of %v because of %v\n", m, err) return false, err } _, err = s.ByKey(ctx, key) if err == datastore.ErrNoSuchEntity { return false, nil } else if err != nil { log.Errorf(ctx, "Failed to get existance of %v because of %v\n", m, err) return false, err } else { return true, nil } }
Version data entries
10 entries across 10 versions & 1 rubygems