當前位置: 首頁>>代碼示例>>Golang>>正文


Golang meddler.Save函數代碼示例

本文整理匯總了Golang中github.com/russross/meddler.Save函數的典型用法代碼示例。如果您正苦於以下問題:Golang Save函數的具體用法?Golang Save怎麽用?Golang Save使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了Save函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。

示例1: SaveMember

// Creates a new Member.
func SaveMember(user, team int64, role string) error {
	r := Role{}
	if err := meddler.QueryRow(db, &r, roleFindStmt, user, team); err == nil {
		r.Role = role
		return meddler.Save(db, memberTable, &r)
	}

	r.UserID = user
	r.TeamID = team
	r.Role = role
	return meddler.Save(db, memberTable, &r)
}
開發者ID:Jyggafey,項目名稱:drone,代碼行數:13,代碼來源:members.go

示例2: SaveSeries

// Saves a Series
func SaveSeries(series *Series) error {
	if series.Id == 0 {
		series.Created = time.Now().UTC()
	}
	series.Updated = time.Now().UTC()
	return meddler.Save(db, seriesTable, series)
}
開發者ID:rharter,項目名稱:mediaman,代碼行數:8,代碼來源:series.go

示例3: SaveSeason

// Saves a season
func SaveSeason(s *Season) error {
	if s.Id == 0 {
		s.Created = time.Now().UTC()
	}
	s.Updated = time.Now().UTC()
	return meddler.Save(db, seasonTable, s)
}
開發者ID:rharter,項目名稱:mediaman,代碼行數:8,代碼來源:season.go

示例4: PutCommit

// PutCommit saves a commit in the datastore.
func (db *Commitstore) PutCommit(commit *model.Commit) error {
	if commit.Created == 0 {
		commit.Created = time.Now().UTC().Unix()
	}
	commit.Updated = time.Now().UTC().Unix()
	return meddler.Save(db, commitTable, commit)
}
開發者ID:zankard,項目名稱:drone,代碼行數:8,代碼來源:commit.go

示例5: Put

// Put inserts an object into the blobstore.
func (b *Blobstore) Put(path string, data []byte) error {
	var blob = resource.Blob{}
	meddler.QueryRow(b, &blob, queryBlob, path)
	blob.Path = path
	blob.Data = string(data)
	return meddler.Save(b, tableBlob, &blob)
}
開發者ID:drone,項目名稱:drone-dart,代碼行數:8,代碼來源:blobstore.go

示例6: Put

// Put inserts an object into the blobstore.
func (db *Blobstore) Put(path string, data []byte) error {
	var blob = Blob{}
	meddler.QueryRow(db, &blob, rebind(blobQuery), path)
	blob.Path = path
	blob.Data = string(data)
	return meddler.Save(db, blobTable, &blob)
}
開發者ID:carnivalmobile,項目名稱:drone,代碼行數:8,代碼來源:blob.go

示例7: SaveRepo

// Creates a new Repository.
func SaveRepo(repo *Repo) error {
	if repo.ID == 0 {
		repo.Created = time.Now().UTC()
	}
	repo.Updated = time.Now().UTC()
	return meddler.Save(db, repoTable, repo)
}
開發者ID:Jyggafey,項目名稱:drone,代碼行數:8,代碼來源:repos.go

示例8: SaveTeam

// Saves a Team.
func SaveTeam(team *Team) error {
	if team.ID == 0 {
		team.Created = time.Now().UTC()
	}
	team.Updated = time.Now().UTC()
	return meddler.Save(db, teamTable, team)
}
開發者ID:Jyggafey,項目名稱:drone,代碼行數:8,代碼來源:teams.go

示例9: PutRepo

// PutRepo saves a repo in the datastore.
func (db *Repostore) PutRepo(repo *model.Repo) error {
	if repo.Created == 0 {
		repo.Created = time.Now().UTC().Unix()
	}
	repo.Updated = time.Now().UTC().Unix()
	return meddler.Save(db, repoTable, repo)
}
開發者ID:voxxit,項目名稱:drone,代碼行數:8,代碼來源:repo.go

示例10: SaveCommit

// Creates a new Commit.
func SaveCommit(commit *Commit) error {
	if commit.ID == 0 {
		commit.Created = time.Now().UTC()
	}
	commit.Updated = time.Now().UTC()
	return meddler.Save(db, commitTable, commit)
}
開發者ID:karolb,項目名稱:drone,代碼行數:8,代碼來源:commits.go

示例11: SaveUser

// Saves the User account.
func SaveUser(user *User) error {
	if user.ID == 0 {
		user.Created = time.Now().UTC()
	}
	user.Updated = time.Now().UTC()
	return meddler.Save(db, userTable, user)
}
開發者ID:kevincwq,項目名稱:drone,代碼行數:8,代碼來源:users.go

示例12: PutUser

// PutUser saves a user in the datastore.
func (db *Userstore) PutUser(user *model.User) error {
	if user.Created == 0 {
		user.Created = time.Now().UTC().Unix()
	}
	user.Updated = time.Now().UTC().Unix()
	return meddler.Save(db, userTable, user)
}
開發者ID:carnivalmobile,項目名稱:drone,代碼行數:8,代碼來源:user.go

示例13: SaveMovie

// Saves a Movie.
func SaveMovie(movie *Movie) error {
	if movie.ID == 0 {
		movie.Created = time.Now().UTC()
	}
	movie.Updated = time.Now().UTC()
	return meddler.Save(db, movieTable, movie)
}
開發者ID:jerrellmardis,項目名稱:mediaman,代碼行數:8,代碼來源:movies.go

示例14: SaveLibrary

// Saves a Library.
func SaveLibrary(library *Library) error {
	if library.ID == 0 {
		library.Created = time.Now().UTC()
	}
	library.Updated = time.Now().UTC()
	return meddler.Save(db, libraryTable, library)
}
開發者ID:jerrellmardis,項目名稱:mediaman,代碼行數:8,代碼來源:libraries.go

示例15: SetSecret

func (db *datastore) SetSecret(sec *model.Secret) error {
	var got = new(model.Secret)
	var err = meddler.QueryRow(db, got, rebind(secretNameQuery), sec.RepoID, sec.Name)
	if err == nil && got.ID != 0 {
		sec.ID = got.ID // update existing id
	}
	return meddler.Save(db, secretTable, sec)
}
開發者ID:Ablu,項目名稱:drone,代碼行數:8,代碼來源:secret.go


注:本文中的github.com/russross/meddler.Save函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。