2017-06-05 11:57:27 +00:00
/* WIP Under Construction */
2018-10-27 03:21:02 +00:00
package main // import "github.com/Azareal/Gosora/query_gen"
2017-06-05 11:57:27 +00:00
2017-10-16 07:32:58 +00:00
import (
"fmt"
"log"
"os"
"runtime/debug"
2018-04-23 08:38:25 +00:00
"strconv"
2017-06-05 11:57:27 +00:00
2018-10-27 03:21:02 +00:00
"github.com/Azareal/Gosora/query_gen"
2017-10-16 07:32:58 +00:00
)
// TODO: Make sure all the errors in this file propagate upwards properly
2017-06-05 11:57:27 +00:00
func main ( ) {
2017-10-16 07:32:58 +00:00
// Capture panics instead of closing the window at a superhuman speed before the user can read the message on Windows
defer func ( ) {
r := recover ( )
if r != nil {
fmt . Println ( r )
debug . PrintStack ( )
return
}
} ( )
2017-06-05 11:57:27 +00:00
log . Println ( "Running the query generator" )
2017-11-12 05:25:04 +00:00
for _ , adapter := range qgen . Registry {
log . Printf ( "Building the queries for the %s adapter" , adapter . GetName ( ) )
2017-07-12 11:05:18 +00:00
qgen . Install . SetAdapterInstance ( adapter )
2017-11-23 05:37:08 +00:00
qgen . Install . AddPlugins ( NewPrimaryKeySpitter ( ) ) // TODO: Do we really need to fill the spitter for every adapter?
2017-10-16 07:32:58 +00:00
err := writeStatements ( adapter )
if err != nil {
log . Print ( err )
}
err = qgen . Install . Write ( )
if err != nil {
log . Print ( err )
}
err = adapter . Write ( )
if err != nil {
log . Print ( err )
}
2017-06-05 11:57:27 +00:00
}
}
2017-09-10 16:57:22 +00:00
// nolint
2017-11-12 05:25:04 +00:00
func writeStatements ( adapter qgen . Adapter ) error {
2017-10-16 07:32:58 +00:00
err := createTables ( adapter )
2017-07-12 11:05:18 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = seedTables ( adapter )
2017-07-12 11:05:18 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeSelects ( adapter )
2017-06-10 07:58:15 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeLeftJoins ( adapter )
2017-06-12 09:03:14 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeInnerJoins ( adapter )
2017-06-10 07:58:15 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeInserts ( adapter )
2017-06-10 07:58:15 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeUpdates ( adapter )
2017-06-12 09:03:14 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeDeletes ( adapter )
2017-06-14 07:09:44 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeSimpleCounts ( adapter )
2017-06-19 08:06:54 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeInsertSelects ( adapter )
2017-06-19 08:06:54 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeInsertLeftJoins ( adapter )
2017-06-19 08:06:54 +00:00
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-10-16 07:32:58 +00:00
err = writeInsertInnerJoins ( adapter )
if err != nil {
return err
}
2017-09-10 16:57:22 +00:00
2017-07-12 11:05:18 +00:00
return nil
}
2017-11-12 05:25:04 +00:00
func seedTables ( adapter qgen . Adapter ) error {
2018-12-31 09:03:49 +00:00
qgen . Install . AddIndex ( "topics" , "parentID" , "parentID" )
qgen . Install . AddIndex ( "replies" , "tid" , "tid" )
qgen . Install . AddIndex ( "polls" , "parentID" , "parentID" )
qgen . Install . AddIndex ( "likes" , "targetItem" , "targetItem" )
qgen . Install . AddIndex ( "emails" , "uid" , "uid" )
qgen . Install . AddIndex ( "attachments" , "originID" , "originID" )
qgen . Install . AddIndex ( "attachments" , "path" , "path" )
qgen . Install . AddIndex ( "activity_stream_matches" , "watcher" , "watcher" )
2017-10-14 07:39:22 +00:00
qgen . Install . SimpleInsert ( "sync" , "last_update" , "UTC_TIMESTAMP()" )
qgen . Install . SimpleInsert ( "settings" , "name, content, type, constraints" , "'activation_type','1','list','1-3'" )
qgen . Install . SimpleInsert ( "settings" , "name, content, type" , "'bigpost_min_words','250','int'" )
qgen . Install . SimpleInsert ( "settings" , "name, content, type" , "'megapost_min_words','1000','int'" )
2017-12-25 06:12:19 +00:00
qgen . Install . SimpleInsert ( "settings" , "name, content, type" , "'meta_desc','','html-attribute'" )
2018-07-13 11:27:58 +00:00
qgen . Install . SimpleInsert ( "settings" , "name, content, type" , "'rapid_loading','1','bool'" )
2019-02-28 07:28:17 +00:00
qgen . Install . SimpleInsert ( "settings" , "name, content, type" , "'google_site_verify','','html-attribute'" )
2018-03-17 08:16:43 +00:00
qgen . Install . SimpleInsert ( "themes" , "uname, default" , "'cosora',1" )
2017-10-14 07:39:22 +00:00
qgen . Install . SimpleInsert ( "emails" , "email, uid, validated" , "'admin@localhost',1,1" ) // ? - Use a different default email or let the admin input it during installation?
/ *
The Permissions :
Global Permissions :
BanUsers
ActivateUsers
EditUser
EditUserEmail
EditUserPassword
EditUserGroup
EditUserGroupSuperMod
EditUserGroupAdmin
EditGroup
EditGroupLocalPerms
EditGroupGlobalPerms
EditGroupSuperMod
EditGroupAdmin
ManageForums
EditSettings
ManageThemes
ManagePlugins
ViewAdminLogs
ViewIPs
Non - staff Global Permissions :
UploadFiles
Forum Permissions :
ViewTopic
LikeItem
CreateTopic
EditTopic
DeleteTopic
CreateReply
EditReply
DeleteReply
PinTopic
CloseTopic
2018-01-15 08:24:18 +00:00
MoveTopic
2017-10-14 07:39:22 +00:00
* /
2017-11-23 05:37:08 +00:00
// TODO: Set the permissions on a struct and then serialize the struct and insert that instead of writing raw JSON
2018-01-15 08:24:18 +00:00
qgen . Install . SimpleInsert ( "users_groups" , "name, permissions, plugin_perms, is_mod, is_admin, tag" , ` 'Administrator',' { "BanUsers":true,"ActivateUsers":true,"EditUser":true,"EditUserEmail":true,"EditUserPassword":true,"EditUserGroup":true,"EditUserGroupSuperMod":true,"EditUserGroupAdmin":false,"EditGroup":true,"EditGroupLocalPerms":true,"EditGroupGlobalPerms":true,"EditGroupSuperMod":true,"EditGroupAdmin":false,"ManageForums":true,"EditSettings":true,"ManageThemes":true,"ManagePlugins":true,"ViewAdminLogs":true,"ViewIPs":true,"UploadFiles":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}',' { }',1,1,"Admin" ` )
2017-10-14 07:39:22 +00:00
2018-01-15 08:24:18 +00:00
qgen . Install . SimpleInsert ( "users_groups" , "name, permissions, plugin_perms, is_mod, tag" , ` 'Moderator',' { "BanUsers":true,"ActivateUsers":false,"EditUser":true,"EditUserEmail":false,"EditUserGroup":true,"ViewIPs":true,"UploadFiles":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"EditTopic":true,"DeleteTopic":true,"CreateReply":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}',' { }',1,"Mod" ` )
2017-10-14 07:39:22 +00:00
qgen . Install . SimpleInsert ( "users_groups" , "name, permissions, plugin_perms" , ` 'Member',' { "UploadFiles":true,"ViewTopic":true,"LikeItem":true,"CreateTopic":true,"CreateReply":true}',' { }' ` )
qgen . Install . SimpleInsert ( "users_groups" , "name, permissions, plugin_perms, is_banned" , ` 'Banned',' { "ViewTopic":true}',' { }',1 ` )
qgen . Install . SimpleInsert ( "users_groups" , "name, permissions, plugin_perms" , ` 'Awaiting Activation',' { "ViewTopic":true}',' { }' ` )
qgen . Install . SimpleInsert ( "users_groups" , "name, permissions, plugin_perms, tag" , ` 'Not Loggedin',' { "ViewTopic":true}',' { }','Guest' ` )
//
// TODO: Stop processFields() from stripping the spaces in the descriptions in the next commit
qgen . Install . SimpleInsert ( "forums" , "name, active, desc" , "'Reports',0,'All the reports go here'" )
qgen . Install . SimpleInsert ( "forums" , "name, lastTopicID, lastReplyerID, desc" , "'General',1,1,'A place for general discussions which don't fit elsewhere'" )
//
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , ` 1,1,' { "ViewTopic":true,"CreateReply":true,"CreateTopic":true,"PinTopic":true,"CloseTopic":true}' ` )
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , ` 2,1,' { "ViewTopic":true,"CreateReply":true,"CloseTopic":true}' ` )
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , "3,1,'{}'" )
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , "4,1,'{}'" )
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , "5,1,'{}'" )
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , "6,1,'{}'" )
//
2018-01-15 08:24:18 +00:00
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , ` 1,2,' { "ViewTopic":true,"CreateReply":true,"CreateTopic":true,"LikeItem":true,"EditTopic":true,"DeleteTopic":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}' ` )
2017-10-14 07:39:22 +00:00
2018-01-15 08:24:18 +00:00
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , ` 2,2,' { "ViewTopic":true,"CreateReply":true,"CreateTopic":true,"LikeItem":true,"EditTopic":true,"DeleteTopic":true,"EditReply":true,"DeleteReply":true,"PinTopic":true,"CloseTopic":true,"MoveTopic":true}' ` )
2017-10-14 07:39:22 +00:00
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , ` 3,2,' { "ViewTopic":true,"CreateReply":true,"CreateTopic":true,"LikeItem":true}' ` )
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , ` 4,2,' { "ViewTopic":true}' ` )
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , ` 5,2,' { "ViewTopic":true}' ` )
qgen . Install . SimpleInsert ( "forums_permissions" , "gid, fid, permissions" , ` 6,2,' { "ViewTopic":true}' ` )
//
2017-11-06 16:24:45 +00:00
qgen . Install . SimpleInsert ( "topics" , "title, content, parsed_content, createdAt, lastReplyAt, lastReplyBy, createdBy, parentID, ipaddress" , "'Test Topic','A topic automatically generated by the software.','A topic automatically generated by the software.',UTC_TIMESTAMP(),UTC_TIMESTAMP(),1,1,2,'::1'" )
2017-10-14 07:39:22 +00:00
2017-11-06 16:24:45 +00:00
qgen . Install . SimpleInsert ( "replies" , "tid, content, parsed_content, createdAt, createdBy, lastUpdated, lastEdit, lastEditBy, ipaddress" , "1,'A reply!','A reply!',UTC_TIMESTAMP(),1,UTC_TIMESTAMP(),0,0,'::1'" )
2017-10-14 07:39:22 +00:00
2018-04-22 12:33:56 +00:00
qgen . Install . SimpleInsert ( "menus" , "" , "" )
2018-04-23 21:08:31 +00:00
// Go maps have a random iteration order, so we have to do this, otherwise the schema files will become unstable and harder to audit
2018-04-23 08:38:25 +00:00
var order = 0
2018-05-11 05:41:51 +00:00
var mOrder = "mid, name, htmlID, cssClass, position, path, aria, tooltip, guestOnly, memberOnly, staffOnly, adminOnly"
2018-04-23 08:38:25 +00:00
var addMenuItem = func ( data map [ string ] interface { } ) {
cols , values := qgen . InterfaceMapToInsertStrings ( data , mOrder )
qgen . Install . SimpleInsert ( "menu_items" , cols + ", order" , values + "," + strconv . Itoa ( order ) )
order ++
}
2018-05-11 05:41:51 +00:00
addMenuItem ( map [ string ] interface { } { "mid" : 1 , "name" : "{lang.menu_forums}" , "htmlID" : "menu_forums" , "position" : "left" , "path" : "/forums/" , "aria" : "{lang.menu_forums_aria}" , "tooltip" : "{lang.menu_forums_tooltip}" } )
2018-04-23 08:38:25 +00:00
2018-05-11 05:41:51 +00:00
addMenuItem ( map [ string ] interface { } { "mid" : 1 , "name" : "{lang.menu_topics}" , "htmlID" : "menu_topics" , "cssClass" : "menu_topics" , "position" : "left" , "path" : "/topics/" , "aria" : "{lang.menu_topics_aria}" , "tooltip" : "{lang.menu_topics_tooltip}" } )
2018-04-23 08:38:25 +00:00
addMenuItem ( map [ string ] interface { } { "mid" : 1 , "htmlID" : "general_alerts" , "cssClass" : "menu_alerts" , "position" : "right" , "tmplName" : "menu_alerts" } )
2018-06-17 07:28:18 +00:00
addMenuItem ( map [ string ] interface { } { "mid" : 1 , "name" : "{lang.menu_account}" , "cssClass" : "menu_account" , "position" : "left" , "path" : "/user/edit/" , "aria" : "{lang.menu_account_aria}" , "tooltip" : "{lang.menu_account_tooltip}" , "memberOnly" : true } )
2018-04-22 12:33:56 +00:00
2018-05-11 05:41:51 +00:00
addMenuItem ( map [ string ] interface { } { "mid" : 1 , "name" : "{lang.menu_profile}" , "cssClass" : "menu_profile" , "position" : "left" , "path" : "{me.Link}" , "aria" : "{lang.menu_profile_aria}" , "tooltip" : "{lang.menu_profile_tooltip}" , "memberOnly" : true } )
2018-04-22 12:33:56 +00:00
2018-05-11 05:41:51 +00:00
addMenuItem ( map [ string ] interface { } { "mid" : 1 , "name" : "{lang.menu_panel}" , "cssClass" : "menu_panel menu_account" , "position" : "left" , "path" : "/panel/" , "aria" : "{lang.menu_panel_aria}" , "tooltip" : "{lang.menu_panel_tooltip}" , "memberOnly" : true , "staffOnly" : true } )
2018-04-23 08:38:25 +00:00
2018-05-11 05:41:51 +00:00
addMenuItem ( map [ string ] interface { } { "mid" : 1 , "name" : "{lang.menu_logout}" , "cssClass" : "menu_logout" , "position" : "left" , "path" : "/accounts/logout/?session={me.Session}" , "aria" : "{lang.menu_logout_aria}" , "tooltip" : "{lang.menu_logout_tooltip}" , "memberOnly" : true } )
2018-04-23 08:38:25 +00:00
2018-05-11 05:41:51 +00:00
addMenuItem ( map [ string ] interface { } { "mid" : 1 , "name" : "{lang.menu_register}" , "cssClass" : "menu_register" , "position" : "left" , "path" : "/accounts/create/" , "aria" : "{lang.menu_register_aria}" , "tooltip" : "{lang.menu_register_tooltip}" , "guestOnly" : true } )
2018-04-23 08:38:25 +00:00
2018-05-11 05:41:51 +00:00
addMenuItem ( map [ string ] interface { } { "mid" : 1 , "name" : "{lang.menu_login}" , "cssClass" : "menu_login" , "position" : "left" , "path" : "/accounts/login/" , "aria" : "{lang.menu_login_aria}" , "tooltip" : "{lang.menu_login_tooltip}" , "guestOnly" : true } )
2018-04-22 12:33:56 +00:00
2017-07-12 11:05:18 +00:00
return nil
}
2018-12-14 04:08:53 +00:00
// ? - What is this for?
/ * func copyInsertMap ( in map [ string ] interface { } ) ( out map [ string ] interface { } ) {
2018-04-23 08:38:25 +00:00
out = make ( map [ string ] interface { } )
for col , value := range in {
out [ col ] = value
}
return out
2018-12-14 04:08:53 +00:00
} * /
2018-04-23 08:38:25 +00:00
type LitStr string
2017-11-12 05:25:04 +00:00
func writeSelects ( adapter qgen . Adapter ) error {
2017-11-13 00:31:46 +00:00
build := adapter . Builder ( )
2017-09-18 17:03:52 +00:00
// Looking for getTopic? Your statement is in another castle
2017-09-10 16:57:22 +00:00
2017-11-13 00:31:46 +00:00
//build.Select("isPluginInstalled").Table("plugins").Columns("installed").Where("uname = ?").Parse()
2017-09-10 16:57:22 +00:00
2017-11-13 00:31:46 +00:00
build . Select ( "forumEntryExists" ) . Table ( "forums" ) . Columns ( "fid" ) . Where ( "name = ''" ) . Orderby ( "fid ASC" ) . Limit ( "0,1" ) . Parse ( )
2017-09-10 16:57:22 +00:00
2017-11-13 00:31:46 +00:00
build . Select ( "groupEntryExists" ) . Table ( "users_groups" ) . Columns ( "gid" ) . Where ( "name = ''" ) . Orderby ( "gid ASC" ) . Limit ( "0,1" ) . Parse ( )
2017-09-10 16:57:22 +00:00
2017-06-10 07:58:15 +00:00
return nil
}
2017-11-12 05:25:04 +00:00
func writeLeftJoins ( adapter qgen . Adapter ) error {
2017-09-18 17:03:52 +00:00
adapter . SimpleLeftJoin ( "getForumTopics" , "topics" , "users" , "topics.tid, topics.title, topics.content, topics.createdBy, topics.is_closed, topics.sticky, topics.createdAt, topics.lastReplyAt, topics.parentID, users.name, users.avatar" , "topics.createdBy = users.uid" , "topics.parentID = ?" , "topics.sticky DESC, topics.lastReplyAt DESC, topics.createdBy desc" , "" )
2017-09-10 16:57:22 +00:00
2017-06-12 09:03:14 +00:00
return nil
}
2017-11-12 05:25:04 +00:00
func writeInnerJoins ( adapter qgen . Adapter ) ( err error ) {
2017-06-10 07:58:15 +00:00
return nil
}
2017-11-12 05:25:04 +00:00
func writeInserts ( adapter qgen . Adapter ) error {
2017-11-13 00:31:46 +00:00
build := adapter . Builder ( )
build . Insert ( "addForumPermsToForum" ) . Table ( "forums_permissions" ) . Columns ( "gid,fid,preset,permissions" ) . Fields ( "?,?,?,?" ) . Parse ( )
2017-09-10 16:57:22 +00:00
2017-06-10 07:58:15 +00:00
return nil
}
2017-11-12 05:25:04 +00:00
func writeUpdates ( adapter qgen . Adapter ) error {
2017-11-13 00:31:46 +00:00
build := adapter . Builder ( )
2017-09-10 16:57:22 +00:00
2017-11-13 00:31:46 +00:00
build . Update ( "updateEmail" ) . Table ( "emails" ) . Set ( "email = ?, uid = ?, validated = ?, token = ?" ) . Where ( "email = ?" ) . Parse ( )
2017-09-10 16:57:22 +00:00
2017-11-13 00:31:46 +00:00
build . Update ( "setTempGroup" ) . Table ( "users" ) . Set ( "temp_group = ?" ) . Where ( "uid = ?" ) . Parse ( )
2017-09-10 16:57:22 +00:00
2017-11-13 00:31:46 +00:00
build . Update ( "bumpSync" ) . Table ( "sync" ) . Set ( "last_update = UTC_TIMESTAMP()" ) . Parse ( )
2017-09-10 16:57:22 +00:00
2017-06-05 11:57:27 +00:00
return nil
}
2017-11-12 05:25:04 +00:00
func writeDeletes ( adapter qgen . Adapter ) error {
2017-11-13 00:31:46 +00:00
build := adapter . Builder ( )
//build.Delete("deleteForumPermsByForum").Table("forums_permissions").Where("fid = ?").Parse()
2017-09-10 16:57:22 +00:00
2017-11-13 00:31:46 +00:00
build . Delete ( "deleteActivityStreamMatch" ) . Table ( "activity_stream_matches" ) . Where ( "watcher = ? AND asid = ?" ) . Parse ( )
//build.Delete("deleteActivityStreamMatchesByWatcher").Table("activity_stream_matches").Where("watcher = ?").Parse()
2017-09-10 16:57:22 +00:00
2017-06-12 09:03:14 +00:00
return nil
2017-06-14 07:09:44 +00:00
}
2017-11-12 05:25:04 +00:00
func writeSimpleCounts ( adapter qgen . Adapter ) error {
2017-06-19 08:06:54 +00:00
return nil
}
2017-11-12 05:25:04 +00:00
func writeInsertSelects ( adapter qgen . Adapter ) error {
2017-10-21 00:27:47 +00:00
/ * adapter . SimpleInsertSelect ( "addForumPermsToForumAdmins" ,
2017-10-14 07:39:22 +00:00
qgen . DB_Insert { "forums_permissions" , "gid, fid, preset, permissions" , "" } ,
2017-09-10 16:57:22 +00:00
qgen . DB_Select { "users_groups" , "gid, ? AS fid, ? AS preset, ? AS permissions" , "is_admin = 1" , "" , "" } ,
2017-10-21 00:27:47 +00:00
) * /
2017-09-10 16:57:22 +00:00
2017-10-21 00:27:47 +00:00
/ * adapter . SimpleInsertSelect ( "addForumPermsToForumStaff" ,
2017-10-14 07:39:22 +00:00
qgen . DB_Insert { "forums_permissions" , "gid, fid, preset, permissions" , "" } ,
2017-09-10 16:57:22 +00:00
qgen . DB_Select { "users_groups" , "gid, ? AS fid, ? AS preset, ? AS permissions" , "is_admin = 0 AND is_mod = 1" , "" , "" } ,
2017-10-21 00:27:47 +00:00
) * /
2017-09-10 16:57:22 +00:00
2017-10-21 00:27:47 +00:00
/ * adapter . SimpleInsertSelect ( "addForumPermsToForumMembers" ,
2017-10-14 07:39:22 +00:00
qgen . DB_Insert { "forums_permissions" , "gid, fid, preset, permissions" , "" } ,
2017-09-10 16:57:22 +00:00
qgen . DB_Select { "users_groups" , "gid, ? AS fid, ? AS preset, ? AS permissions" , "is_admin = 0 AND is_mod = 0 AND is_banned = 0" , "" , "" } ,
2017-10-21 00:27:47 +00:00
) * /
2017-09-10 16:57:22 +00:00
2017-06-19 08:06:54 +00:00
return nil
}
2017-09-10 16:57:22 +00:00
// nolint
2017-11-12 05:25:04 +00:00
func writeInsertLeftJoins ( adapter qgen . Adapter ) error {
2017-06-19 08:06:54 +00:00
return nil
}
2017-11-12 05:25:04 +00:00
func writeInsertInnerJoins ( adapter qgen . Adapter ) error {
2017-06-14 07:09:44 +00:00
return nil
}
2017-10-16 07:32:58 +00:00
func writeFile ( name string , content string ) ( err error ) {
f , err := os . Create ( name )
if err != nil {
return err
}
_ , err = f . WriteString ( content )
if err != nil {
return err
}
err = f . Sync ( )
if err != nil {
return err
}
return f . Close ( )
}