github.com/Azareal/Gosora@v0.0.0-20210729070923-553e66b59003/gen_pgsql.go (about)

     1  // +build pgsql
     2  
     3  // This file was generated by Gosora's Query Generator. Please try to avoid modifying this file, as it might change at any time.
     4  package main
     5  
     6  import "log"
     7  import "database/sql"
     8  import "github.com/Azareal/Gosora/common"
     9  
    10  // nolint
    11  type Stmts struct {
    12  	addForumPermsToForum *sql.Stmt
    13  	updateEmail *sql.Stmt
    14  	setTempGroup *sql.Stmt
    15  	bumpSync *sql.Stmt
    16  
    17  	getActivityFeedByWatcher *sql.Stmt
    18  	getActivityCountByWatcher *sql.Stmt
    19  
    20  	Mocks bool
    21  }
    22  
    23  // nolint
    24  func _gen_pgsql() (err error) {
    25  	common.DebugLog("Building the generated statements")
    26  	
    27  	common.DebugLog("Preparing addForumPermsToForum statement.")
    28  	stmts.addForumPermsToForum, err = db.Prepare("INSERT INTO \"forums_permissions\"(\"gid\",\"fid\",\"preset\",\"permissions\") VALUES (?,?,?,?)")
    29  	if err != nil {
    30  		log.Print("Error in addForumPermsToForum statement.")
    31  		return err
    32  	}
    33  		
    34  	common.DebugLog("Preparing updateEmail statement.")
    35  	stmts.updateEmail, err = db.Prepare("UPDATE \"emails\" SET `email`= ?,`uid`= ?,`validated`= ?,`token`= ? WHERE `email` = ?")
    36  	if err != nil {
    37  		log.Print("Error in updateEmail statement.")
    38  		return err
    39  	}
    40  		
    41  	common.DebugLog("Preparing setTempGroup statement.")
    42  	stmts.setTempGroup, err = db.Prepare("UPDATE \"users\" SET `temp_group`= ? WHERE `uid` = ?")
    43  	if err != nil {
    44  		log.Print("Error in setTempGroup statement.")
    45  		return err
    46  	}
    47  		
    48  	common.DebugLog("Preparing bumpSync statement.")
    49  	stmts.bumpSync, err = db.Prepare("UPDATE \"sync\" SET `last_update`= LOCALTIMESTAMP()")
    50  	if err != nil {
    51  		log.Print("Error in bumpSync statement.")
    52  		return err
    53  	}
    54  	
    55  	return nil
    56  }