f41c281e43
The themes are still going to be a little broken for a while, but here's the progress I've made. Renamed the topics_trow_assign hook to topics_topic_row_assign. Added more debug code to the generated router. Added a robots.txt file. Gosora now responds to favicon.ico requests with a 404 rather than the topic list. Fixed the tests and some of the benchmarks. Changed the default UserCacheCapacity from 100 to 120. Changed the default TopicCacheCapacity from 100 to 200. Added the last replyer to the topics list and the forum pages. Added the BulkCascadeGetMap method to the UserStore. Refactored the topics list and forum page to load the users with a call to the UserStore rather than via a join. WebSockets now work on SSL. Fixed a race condition when the user permissions are initialised at the start of a request. Fixed a race condition when the user permissions for the OP of a topic are initialised. The rows.Close() calls are deferred once more, so that we can catch problems with recover() Improved support for struct pointers in the template compiler. Added a pin emoji to pinned topics to make them stand-out on the Shadow theme, we have some other ideas in mind for this, but I'd like to get Shadow fully functional for this commit. Fixed a bug an issue with Chrome not detecting XHTML style closes on <form>s. Fixed a visual issue with `color` not being set for textarea elements for the Shadow theme. Fixed a function which wasn't getting renamed for PGSQL. Added seven new UserStore tests.
135 lines
2.9 KiB
Go
135 lines
2.9 KiB
Go
/* WIP Under Construction */
|
|
package qgen
|
|
|
|
import "errors"
|
|
|
|
var DB_Registry []DB_Adapter
|
|
var No_Adapter = errors.New("This adapter doesn't exist")
|
|
|
|
type DB_Table_Column struct
|
|
{
|
|
Name string
|
|
Type string
|
|
Size int
|
|
Null bool
|
|
Auto_Increment bool
|
|
Default string
|
|
}
|
|
|
|
type DB_Table_Key struct
|
|
{
|
|
Columns string
|
|
Type string
|
|
}
|
|
|
|
type DB_Select struct
|
|
{
|
|
Table string
|
|
Columns string
|
|
Where string
|
|
Orderby string
|
|
Limit string
|
|
}
|
|
|
|
type DB_Join struct
|
|
{
|
|
Table1 string
|
|
Table2 string
|
|
Columns string
|
|
Joiners string
|
|
Where string
|
|
Orderby string
|
|
Limit string
|
|
}
|
|
|
|
type DB_Insert struct
|
|
{
|
|
Table string
|
|
Columns string
|
|
Fields string
|
|
}
|
|
|
|
type DB_Column struct
|
|
{
|
|
Table string
|
|
Left string // Could be a function or a column, so I'm naming this Left
|
|
Alias string // aka AS Blah, if it's present
|
|
Type string // function or column
|
|
}
|
|
|
|
type DB_Field struct
|
|
{
|
|
Name string
|
|
Type string
|
|
}
|
|
|
|
type DB_Where struct
|
|
{
|
|
Expr []DB_Token // Simple expressions, the innards of functions are opaque for now.
|
|
}
|
|
|
|
type DB_Joiner struct
|
|
{
|
|
LeftTable string
|
|
LeftColumn string
|
|
RightTable string
|
|
RightColumn string
|
|
Operator string
|
|
}
|
|
|
|
type DB_Order struct
|
|
{
|
|
Column string
|
|
Order string
|
|
}
|
|
|
|
type DB_Token struct {
|
|
Contents string
|
|
Type string // function, operator, column, number, string, substitute
|
|
}
|
|
|
|
type DB_Setter struct {
|
|
Column string
|
|
Expr []DB_Token // Simple expressions, the innards of functions are opaque for now.
|
|
}
|
|
|
|
type DB_Limit struct {
|
|
Offset string // ? or int
|
|
MaxCount string // ? or int
|
|
}
|
|
|
|
type DB_Stmt struct
|
|
{
|
|
Contents string
|
|
Type string // create-table, insert, update, delete
|
|
}
|
|
|
|
type DB_Adapter interface {
|
|
GetName() string
|
|
CreateTable(name string, table string, charset string, collation string, columns []DB_Table_Column, keys []DB_Table_Key) (string, error)
|
|
SimpleInsert(name string, table string, columns string, fields string) (string, error)
|
|
SimpleReplace(name string, table string, columns string, fields string) (string, error)
|
|
SimpleUpdate(name string, table string, set string, where string) (string, error)
|
|
SimpleDelete(name string, table string, where string) (string, error)
|
|
Purge(name string, table string) (string, error)
|
|
SimpleSelect(name string, table string, columns string, where string, orderby string, limit string) (string, error)
|
|
SimpleLeftJoin(name string, table1 string, table2 string, columns string, joiners string, where string, orderby string, limit string) (string, error)
|
|
SimpleInnerJoin(string,string,string,string,string,string,string,string) (string, error)
|
|
SimpleInsertSelect(string,DB_Insert,DB_Select) (string,error)
|
|
SimpleInsertLeftJoin(string,DB_Insert,DB_Join) (string,error)
|
|
SimpleInsertInnerJoin(string,DB_Insert,DB_Join) (string,error)
|
|
SimpleCount(string,string,string,string) (string, error)
|
|
Write() error
|
|
|
|
// TO-DO: Add a simple query builder
|
|
}
|
|
|
|
func GetAdapter(name string) (adap DB_Adapter, err error) {
|
|
for _, adapter := range DB_Registry {
|
|
if adapter.GetName() == name {
|
|
return adapter, nil
|
|
}
|
|
}
|
|
return adap, No_Adapter
|
|
}
|