Creates a new unique record
969469
def _create_record(self, rtype, name, content):
        """"""
        found = self._list_records(rtype=rtype, name=name, content=content)
        if found:
            return True

        record = self._create_request_record(None, rtype, name, content,
                                             self._get_lexicon_option('ttl'),
                                             self._get_lexicon_option('priority'))

        self._request_add_dns_record(record)
        return True
297471
public Record createSharedRecord(Object objKey, RecordOwner recordOwner)
    {
        if (objKey instanceof Integer)
        {
            int iCalendarType = ((Integer)objKey).intValue();
            if (iCalendarType == CalendarEntry.APPOINTMENT_ID)
                return new Appointment(recordOwner);
            if (iCalendarType == CalendarEntry.ANNIVERSARY_ID)
                return new Anniversary(recordOwner);
        }
        return null;
    }
437736
def _create_record
        # check if class has custom create method
        if self.class.custom_create_method
          # run before/after callbacks defined in model
          run_callbacks(:create) do
            # timestamp
            if self.record_timestamps
              current_time = current_time_from_proper_timezone

              all_timestamp_attributes_in_model.each do |column|
                if respond_to?(column) && respond_to?("#{column}=") && self.send(column).nil?
                  write_attribute(column.to_s, current_time)
                end
              end
            end
            # run
            create_using_custom_method
          end
        else
          super
        end
      end
953022
def _create_record(self, name, address, ttl):
        """"""
        data = json.dumps({'record': {'name': name,
                                      'record_type': 'A',
                                      'content': address,
                                      'ttl': ttl}})
        headers = {'Content-Type': 'application/json'}
        request = self._session.post(self._baseurl, data=data, headers=headers)
        if not request.ok:
            raise RuntimeError('Failed to create new record: %s - %s' %
                               (self._format_hostname(name), request.json()))
        record = request.json()
        if 'record' not in record or 'id' not in record['record']:
            raise RuntimeError('Invalid record JSON format: %s - %s' %
                               (self._format_hostname(name), request.json()))
        return record['record']
595832
private void createUniqueIndexGFS(DBCollection coll, String id)
    {
        try
        {
            coll.createIndex(new BasicDBObject("metadata." + id, 1), new BasicDBObject("unique", true));
        }
        catch (MongoException ex)
        {
            throw new KunderaException("Error in creating unique indexes in " + coll.getFullName() + " collection on "
                    + id + " field");
        }
    }
357685
def create(self):
        

        # Ensure that an existing document will not be "updated"
        doc = dict(self)
        if doc.get('_rev') is not None:
            doc.__delitem__('_rev')

        headers = {'Content-Type': 'application/json'}
        resp = self.r_session.post(
            self._database.database_url,
            headers=headers,
            data=json.dumps(doc, cls=self.encoder)
        )
        resp.raise_for_status()
        data = response_to_json_dict(resp)
        super(Document, self).__setitem__('_id', data['id'])
        super(Document, self).__setitem__('_rev', data['rev'])
835112
def create(cls, **kw):
        
        for k, v in kw.items():
            attr = getattr(cls, k, None)
            if isinstance(attr, RecordAttribute):
                kw.pop(k)
                kw.update(attr._decompose(v))
        return cls(**kw)
27912
public RecordList getUniqueRecordsBy(String fieldName) {
        Set<String> uniqueKeys = new HashSet<String>();
        final RecordListBuilder uniqueRecordListBuilder = new RecordListBuilder(schema);
        for (int rowIndex = 0; rowIndex < this.size(); rowIndex++) {
            final Record currentRecord = this.records.get(rowIndex);
            String uniqueKeyField = currentRecord.getValueByFieldName(fieldName);
            if(!uniqueKeys.contains(uniqueKeyField)){
                uniqueRecordListBuilder.add(currentRecord);
            }
            uniqueKeys.add(uniqueKeyField);
        }
        return uniqueRecordListBuilder.createRecordList(dataSourceHash);
    }
256534
function inputRecord (type, record) {
  const clone = {};
  const recordTypes = this.recordTypes;
  const primaryKey = this.keys.primary;
  const isArrayKey = this.keys.isArray;
  const generateId = this.options.generateId;
  const fields = recordTypes[type];

  // ID business.
  const id = record[primaryKey];
  clone[idKey] = id ? id : generateId(type);

  for (const field in record) {
    if (field === primaryKey) continue;
    clone[field] = record[field];
  }

  for (const field of Object.getOwnPropertyNames(fields))
    if (!(field in record))
      clone[field] = fields[field][isArrayKey] ? [] : null;

  return clone;
}
534599
def push_unique(field)
      push(field) unless @fields.detect { |f| f.name? field.name }
      self
    end
543711
def _get_unique(self, *args):
        """"""

        # Generate a unique values
        value = ''
        attempts = 0
        while True:
            attempts += 1
            value = self._maker(*args)
            if value not in self._used_values:
                break

            assert attempts < self._max_attempts, \
                'Too many attempts to generate a unique value'

        # Add the value to the set of used values
        self._used_values.add(value)

        return value
42961
def create(self, method, uri, params=None, data=None, headers=None, auth=None, timeout=None,
               allow_redirects=False):
        
        response = self.request(
            method,
            uri,
            params=params,
            data=data,
            headers=headers,
            auth=auth,
            timeout=timeout,
            allow_redirects=allow_redirects,
        )

        if response.status_code < 200 or response.status_code >= 300:
            raise self.exception(method, uri, response, 'Unable to create record')

        return json.loads(response.text)
645874
def add_unique_id(self):
        
        
        uid = 0
        for feature in self._data["features"]:
            if feature["properties"].get("id"):
                raise Exception("one of the features already had an id field")
            feature["properties"]["id"] = uid
            uid += 1
1329118
public UniqueModel unique(String uniqueName) {
		checkReadOnly();
		UniqueModel unique = new UniqueModel();
		unique.setName(uniqueName);
		unique.setTableModel(this);
		getUniqueConsts().add(unique);
		return unique;
	}
1197898
function recordUnique(name, uniqueId, statistics, aggregations, timestamp, callback) {
        timestamp = timestamp || Date.now();
        // normal record
        if(statistics) {
            var num = Array.isArray(uniqueId) ? uniqueId.length : 1;
            record(name, num, statistics, aggregations, timestamp);
        }
        // record unique
        var multi = redis.multi();
        granularities.forEach(function(gran) {
                var key = getGranKey(name, gran, timestamp);
                var expireTime = util.getExpireTime(gran, timestamp);
                var pfkey = key + ':pf';
                multi.hset(keyPFKeys, pfkey, expireTime);
                if(Array.isArray(uniqueId)) {
                    multi.pfadd.apply(multi, [pfkey].concat(uniqueId));
                } else {
                    multi.pfadd(pfkey, uniqueId);
                }
                // recordStats(key);
                var unitPeriod = gran[0];
                multi.hincrby(key, 'uni', 0);
                multi.expire(key, points * unitPeriod / 1000);
        });
        multi.exec(callback || log);
    }
1211405
def create!(attributes)
      new_attributes = map_to_keys(attributes)

      new_attributes = new_attributes.merge(
        RecordTypeManager::FIELD_NAME => klass.record_type_id
      ) if klass.record_type_id

      client.create!(klass.object_name, new_attributes)
    end
212687
function create_new() {
        var id

        // Check if we already have an id or if
        // we need to generate a new one.
        if (undefined !== ent.id$) {
          // Take a copy of the existing id and
          // delete it from the ent object. Do
          // save will handle the id for us.
          id = ent.id$
          delete ent.id$

          // Save with the existing id
          return do_save(id, true)
        }

        // Generate a new id
        id = options.generate_id ? options.generate_id(ent) : void 0

        if (undefined !== id) {
          return do_save(id, true)
        } else {
          var gen_id = {
            role: 'basic',
            cmd: 'generate_id',
            name: name,
            base: base,
            zone: zone
          }

          // When we get a respones we will use the id param
          // as our entity id, if this fails we just fail and
          // call reply() as we have no way to save without an id
          seneca.act(gen_id, function(err, id) {
            if (err) return reply(err)
            do_save(id, true)
          })
        }
      }