Sha256: 480522a4c3cea89c69c3c2089eeca2b311c14b2d470251e22c548c627b2ef5b3
Contents?: true
Size: 622 Bytes
Versions: 10
Compression:
Stored size: 622 Bytes
Contents
<%- import 'context' import 'fmt' import model.package import 'google.golang.org/appengine/datastore' import 'google.golang.org/appengine/log' -%> func (s *<%= type.name %>) Create(ctx context.Context, m *<%= model.qualified_name %>) (*datastore.Key, error) { if err := m.PrepareToCreate(); err != nil { return nil, err } return s.PutWith(ctx, m, func() error { exist, err := s.Exist(ctx, m) if err != nil { return err } if exist { log.Errorf(ctx, "Failed to create %v because of another entity has same key\n", m) return fmt.Errorf("Duplicate ID error: %q of %v\n", m.ID, m) } return nil }) }
Version data entries
10 entries across 10 versions & 1 rubygems