本文整理匯總了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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}
示例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)
}