// Insert a user
162640
func (s *UserStorage) Insert(c model.User) string {
	id := fmt.Sprintf("%d", s.idCount)
	c.ID = id
	s.users[id] = &c
	s.idCount++
	return id
}
1256414
func NewUsersDB() app.UserDBService {
	db := &usersDB{
		users: make(map[string]schema.User),
	}
	// Insert one example user for demo purposes
	db.Insert("example@user.com", "example user")
	return db
}
388247
func (m *Manager) Insert(c *GlobalConfig) error {
	err := m.collection.Insert(c)

	return err
}
1172451
func (s *UserService) CreateUser(ctx context.Context, o *influxdb.User) error {
	p, err := influxdb.NewGlobalPermission(influxdb.WriteAction, influxdb.UsersResourceType)
	if err != nil {
		return err
	}

	if err := IsAllowed(ctx, *p); err != nil {
		return err
	}

	return s.s.CreateUser(ctx, o)
}
1025321
func (db *DynamoDB) SaveUser(u *models.User) error {
	if u.ID == "" {
		id, err := shortid.ID(64)
		if err != nil {
			return err
		}

		u.ID = id
	}

	item, err := dynamodbattribute.MarshalMap(u)
	if err != nil {
		return err
	}

	_, err = db.DB.PutItem(&dynamodb.PutItemInput{
		TableName: aws.String("users"),
		Item:      item,
	})
	if err != nil {
		return err
	}

	return nil
}
122896
func (b MongodbAuthBackend) SaveUser(user UserData) error {
	c := b.connect()
	defer c.Database.Session.Close()

	_, err := c.Upsert(bson.M{"Username": user.Username}, bson.M{"$set": user})
	return err
}
1059569
func (b LeveldbAuthBackend) User(username string) (user UserData, e error) {
	if user, ok := b.users[username]; ok {
		return user, nil
	}
	return user, ErrMissingUser
}
607987
func (s *Service) CreateUser(ctx context.Context, u *influxdb.User) error {
	return s.kv.Update(ctx, func(tx Tx) error {
		return s.createUser(ctx, tx, u)
	})
}
595389
func (v *VoiceTarget) AddUser(user *User) {
	v.users = append(v.users, user)
}
717469
func (engine *Engine) Insert(beans ...interface{}) (int64, error) {
	session := engine.NewSession()
	defer session.Close()
	return session.Insert(beans...)
}
749086
func (u *usersService) CreateUser(email, fullname string) (schema.User, error) {
	return u.db.Insert(email, fullname)
}
12028
func (auup *AuthUserUserPermission) Insert(db XODB) error {
	var err error

	// if already exist, bail
	if auup._exists {
		return errors.New("insert failed: already exists")
	}

	// sql insert query, primary key provided by autoincrement
	const sqlstr = `INSERT INTO django.auth_user_user_permissions (` +
		`user_id, permission_id` +
		`) VALUES (` +
		`?, ?` +
		`)`

	// run query
	XOLog(sqlstr, auup.UserID, auup.PermissionID)
	res, err := db.Exec(sqlstr, auup.UserID, auup.PermissionID)
	if err != nil {
		return err
	}

	// retrieve id
	id, err := res.LastInsertId()
	if err != nil {
		return err
	}

	// set primary key and existence
	auup.ID = int(id)
	auup._exists = true

	return nil
}
33521
func (s *UserService) CreateUser(p *CreateUserParams) (*CreateUserResponse, error) {
	resp, err := s.cs.newRequest("createUser", p.toURLValues())
	if err != nil {
		return nil, err
	}

	if resp, err = getRawValue(resp); err != nil {
		return nil, err
	}

	var r CreateUserResponse
	if err := json.Unmarshal(resp, &r); err != nil {
		return nil, err
	}

	return &r, nil
}
233933
func (c *CloudPersister) AddUser(b *models.User) (*models.User, error) {
	ctx := context.Background()
	k := datastore.NewIncompleteKey(ctx, "User", nil)
	k, err := c.DatastoreClient().Put(ctx, k, b)
	if err != nil {
		return nil, fmt.Errorf("datastoredb: could not put User: %v", err)
	}
	b.ID = k.ID()
	return b, nil
}
1251542
func (c *Client) PutUser(ctx context.Context, u *platform.User) error {
	return c.db.Update(func(tx *bolt.Tx) error {
		return c.putUser(ctx, tx, u)
	})
}
113644
func (s *Service) PutUser(ctx context.Context, o *platform.User) error {
	s.userKV.Store(o.ID.String(), o)
	return nil
}
1128064
func (ap *AuthPermission) Insert(db XODB) error {
	var err error

	// if already exist, bail
	if ap._exists {
		return errors.New("insert failed: already exists")
	}

	// sql insert query, primary key provided by autoincrement
	const sqlstr = `INSERT INTO auth_permission (` +
		`content_type_id, codename, name` +
		`) VALUES (` +
		`?, ?, ?` +
		`)`

	// run query
	XOLog(sqlstr, ap.ContentTypeID, ap.Codename, ap.Name)
	res, err := db.Exec(sqlstr, ap.ContentTypeID, ap.Codename, ap.Name)
	if err != nil {
		return err
	}

	// retrieve id
	id, err := res.LastInsertId()
	if err != nil {
		return err
	}

	// set primary key and existence
	ap.ID = int(id)
	ap._exists = true

	return nil
}