3
0

upd(all): codegen uint64 types with string encoding

This commit is contained in:
Tit Petric
2018-10-16 18:12:04 +02:00
parent c5d70ef264
commit e259a949b8
10 changed files with 73 additions and 73 deletions

View File

@@ -22,7 +22,7 @@ var _ = multipart.FileHeader{}
type {name|expose}{call.name|capitalize} struct {
{foreach $call.parameters as $params}
{foreach $params as $method => $param}
{param.name|expose} {param.type}{newline}
{param.name|expose} {param.type}{if $param.type === "uint64"} `json:",string"`{/if}{newline}
{/foreach}
{/foreach}
}

View File

@@ -129,7 +129,7 @@ var _ RequestFiller = NewModuleCreate()
// Module read request parameters
type ModuleRead struct {
ID uint64
ID uint64 `json:",string"`
}
func NewModuleRead() *ModuleRead {
@@ -171,7 +171,7 @@ var _ RequestFiller = NewModuleRead()
// Module edit request parameters
type ModuleEdit struct {
ID uint64
ID uint64 `json:",string"`
Name string
Fields types.JSONText
}
@@ -225,7 +225,7 @@ var _ RequestFiller = NewModuleEdit()
// Module delete request parameters
type ModuleDelete struct {
ID uint64
ID uint64 `json:",string"`
}
func NewModuleDelete() *ModuleDelete {
@@ -269,7 +269,7 @@ var _ RequestFiller = NewModuleDelete()
type ModuleContentList struct {
Page int
PerPage int
ModuleID uint64
ModuleID uint64 `json:",string"`
}
func NewModuleContentList() *ModuleContentList {
@@ -319,7 +319,7 @@ var _ RequestFiller = NewModuleContentList()
// Module content/create request parameters
type ModuleContentCreate struct {
ModuleID uint64
ModuleID uint64 `json:",string"`
Fields types.JSONText
}
@@ -368,8 +368,8 @@ var _ RequestFiller = NewModuleContentCreate()
// Module content/read request parameters
type ModuleContentRead struct {
ModuleID uint64
ID uint64
ModuleID uint64 `json:",string"`
ID uint64 `json:",string"`
}
func NewModuleContentRead() *ModuleContentRead {
@@ -412,8 +412,8 @@ var _ RequestFiller = NewModuleContentRead()
// Module content/edit request parameters
type ModuleContentEdit struct {
ModuleID uint64
ID uint64
ModuleID uint64 `json:",string"`
ID uint64 `json:",string"`
Fields types.JSONText
}
@@ -463,8 +463,8 @@ var _ RequestFiller = NewModuleContentEdit()
// Module content/delete request parameters
type ModuleContentDelete struct {
ModuleID uint64
ID uint64
ModuleID uint64 `json:",string"`
ID uint64 `json:",string"`
}
func NewModuleContentDelete() *ModuleContentDelete {

View File

@@ -71,8 +71,8 @@ var _ RequestFiller = NewPageList()
// Page create request parameters
type PageCreate struct {
SelfID uint64
ModuleID uint64
SelfID uint64 `json:",string"`
ModuleID uint64 `json:",string"`
Title string
Description string
Visible bool
@@ -143,7 +143,7 @@ var _ RequestFiller = NewPageCreate()
// Page read request parameters
type PageRead struct {
ID uint64
ID uint64 `json:",string"`
}
func NewPageRead() *PageRead {
@@ -185,9 +185,9 @@ var _ RequestFiller = NewPageRead()
// Page edit request parameters
type PageEdit struct {
ID uint64
SelfID uint64
ModuleID uint64
ID uint64 `json:",string"`
SelfID uint64 `json:",string"`
ModuleID uint64 `json:",string"`
Title string
Description string
Visible bool
@@ -259,7 +259,7 @@ var _ RequestFiller = NewPageEdit()
// Page delete request parameters
type PageDelete struct {
ID uint64
ID uint64 `json:",string"`
}
func NewPageDelete() *PageDelete {

View File

@@ -9,8 +9,8 @@ import (
type (
// Content is a stored row in the `content` table
Content struct {
ID uint64 `json:"id" db:"id"`
ModuleID uint64 `json:"moduleID" db:"module_id"`
ID uint64 `json:"id,string" db:"id"`
ModuleID uint64 `json:"moduleID,string" db:"module_id"`
Page *Page `json:"page,omitempty"`
Fields types.JSONText `json:"fields,omitempty" db:"-"`
@@ -22,7 +22,7 @@ type (
// ContentColumn is a stored row in the `content_column` table
ContentColumn struct {
ContentID uint64 `json:"contentID" db:"content_id"`
ContentID uint64 `json:"contentID,string" db:"content_id"`
Name string `json:"name" db:"column_name"`
Value string `json:"value" db:"column_value"`
}
@@ -36,7 +36,7 @@ type (
// Modules - CRM module definitions
Module struct {
ID uint64 `json:"id" db:"id"`
ID uint64 `json:"id,string" db:"id"`
Name string `json:"name" db:"name"`
Fields types.JSONText `json:"fields" db:"json"`
@@ -49,7 +49,7 @@ type (
// Modules - CRM module definitions
ModuleField struct {
ModuleID uint64 `json:"moduleID" db:"module_id"`
ModuleID uint64 `json:"moduleID,string" db:"module_id"`
Place int `json:"-" db:"place"`
Kind string `json:"kind" db:"kind"`
@@ -63,10 +63,10 @@ type (
// Page - page structure
Page struct {
ID uint64 `json:"id" db:"id"`
SelfID uint64 `json:"selfID" db:"self_id"`
ID uint64 `json:"id,string" db:"id"`
SelfID uint64 `json:"selfID,string" db:"self_id"`
ModuleID uint64 `json:"moduleID" db:"module_id"`
ModuleID uint64 `json:"moduleID,string" db:"module_id"`
Module *Module `json:"module,omitempty" db:"-"`
Title string `json:"title" db:"title"`

View File

@@ -33,7 +33,7 @@ var _ = multipart.FileHeader{}
// Attachment original request parameters
type AttachmentOriginal struct {
Download bool
AttachmentID uint64
AttachmentID uint64 `json:",string"`
}
func NewAttachmentOriginal() *AttachmentOriginal {
@@ -79,7 +79,7 @@ var _ RequestFiller = NewAttachmentOriginal()
// Attachment preview request parameters
type AttachmentPreview struct {
AttachmentID uint64
AttachmentID uint64 `json:",string"`
}
func NewAttachmentPreview() *AttachmentPreview {

View File

@@ -132,12 +132,12 @@ var _ RequestFiller = NewChannelCreate()
// Channel edit request parameters
type ChannelEdit struct {
ChannelID uint64
ChannelID uint64 `json:",string"`
Name string
Topic string
Type string
Archive bool
OrganisationID uint64
OrganisationID uint64 `json:",string"`
}
func NewChannelEdit() *ChannelEdit {
@@ -199,7 +199,7 @@ var _ RequestFiller = NewChannelEdit()
// Channel read request parameters
type ChannelRead struct {
ChannelID uint64
ChannelID uint64 `json:",string"`
}
func NewChannelRead() *ChannelRead {
@@ -241,7 +241,7 @@ var _ RequestFiller = NewChannelRead()
// Channel delete request parameters
type ChannelDelete struct {
ChannelID uint64
ChannelID uint64 `json:",string"`
}
func NewChannelDelete() *ChannelDelete {
@@ -283,7 +283,7 @@ var _ RequestFiller = NewChannelDelete()
// Channel members request parameters
type ChannelMembers struct {
ChannelID uint64
ChannelID uint64 `json:",string"`
}
func NewChannelMembers() *ChannelMembers {
@@ -325,8 +325,8 @@ var _ RequestFiller = NewChannelMembers()
// Channel join request parameters
type ChannelJoin struct {
ChannelID uint64
UserID uint64
ChannelID uint64 `json:",string"`
UserID uint64 `json:",string"`
}
func NewChannelJoin() *ChannelJoin {
@@ -369,8 +369,8 @@ var _ RequestFiller = NewChannelJoin()
// Channel part request parameters
type ChannelPart struct {
ChannelID uint64
UserID uint64
ChannelID uint64 `json:",string"`
UserID uint64 `json:",string"`
}
func NewChannelPart() *ChannelPart {
@@ -413,7 +413,7 @@ var _ RequestFiller = NewChannelPart()
// Channel invite request parameters
type ChannelInvite struct {
ChannelID uint64
ChannelID uint64 `json:",string"`
UserID []uint64
}
@@ -456,7 +456,7 @@ var _ RequestFiller = NewChannelInvite()
// Channel attach request parameters
type ChannelAttach struct {
ChannelID uint64
ChannelID uint64 `json:",string"`
Upload *multipart.FileHeader
}

View File

@@ -33,7 +33,7 @@ var _ = multipart.FileHeader{}
// Message create request parameters
type MessageCreate struct {
Message string
ChannelID uint64
ChannelID uint64 `json:",string"`
}
func NewMessageCreate() *MessageCreate {
@@ -79,8 +79,8 @@ var _ RequestFiller = NewMessageCreate()
// Message history request parameters
type MessageHistory struct {
LastMessageID uint64
ChannelID uint64
LastMessageID uint64 `json:",string"`
ChannelID uint64 `json:",string"`
}
func NewMessageHistory() *MessageHistory {
@@ -126,8 +126,8 @@ var _ RequestFiller = NewMessageHistory()
// Message edit request parameters
type MessageEdit struct {
MessageID uint64
ChannelID uint64
MessageID uint64 `json:",string"`
ChannelID uint64 `json:",string"`
Message string
}
@@ -175,8 +175,8 @@ var _ RequestFiller = NewMessageEdit()
// Message delete request parameters
type MessageDelete struct {
MessageID uint64
ChannelID uint64
MessageID uint64 `json:",string"`
ChannelID uint64 `json:",string"`
}
func NewMessageDelete() *MessageDelete {
@@ -221,7 +221,7 @@ var _ RequestFiller = NewMessageDelete()
type MessageSearch struct {
Query string
Message_type string
ChannelID uint64
ChannelID uint64 `json:",string"`
}
func NewMessageSearch() *MessageSearch {
@@ -271,8 +271,8 @@ var _ RequestFiller = NewMessageSearch()
// Message pin request parameters
type MessagePin struct {
MessageID uint64
ChannelID uint64
MessageID uint64 `json:",string"`
ChannelID uint64 `json:",string"`
}
func NewMessagePin() *MessagePin {
@@ -315,8 +315,8 @@ var _ RequestFiller = NewMessagePin()
// Message unpin request parameters
type MessageUnpin struct {
MessageID uint64
ChannelID uint64
MessageID uint64 `json:",string"`
ChannelID uint64 `json:",string"`
}
func NewMessageUnpin() *MessageUnpin {
@@ -359,8 +359,8 @@ var _ RequestFiller = NewMessageUnpin()
// Message flag request parameters
type MessageFlag struct {
MessageID uint64
ChannelID uint64
MessageID uint64 `json:",string"`
ChannelID uint64 `json:",string"`
}
func NewMessageFlag() *MessageFlag {
@@ -403,8 +403,8 @@ var _ RequestFiller = NewMessageFlag()
// Message unflag request parameters
type MessageUnflag struct {
MessageID uint64
ChannelID uint64
MessageID uint64 `json:",string"`
ChannelID uint64 `json:",string"`
}
func NewMessageUnflag() *MessageUnflag {
@@ -447,9 +447,9 @@ var _ RequestFiller = NewMessageUnflag()
// Message react request parameters
type MessageReact struct {
MessageID uint64
MessageID uint64 `json:",string"`
Reaction string
ChannelID uint64
ChannelID uint64 `json:",string"`
}
func NewMessageReact() *MessageReact {
@@ -493,9 +493,9 @@ var _ RequestFiller = NewMessageReact()
// Message unreact request parameters
type MessageUnreact struct {
MessageID uint64
MessageID uint64 `json:",string"`
Reaction string
ChannelID uint64
ChannelID uint64 `json:",string"`
}
func NewMessageUnreact() *MessageUnreact {

View File

@@ -122,7 +122,7 @@ var _ RequestFiller = NewOrganisationCreate()
// Organisation edit request parameters
type OrganisationEdit struct {
ID uint64
ID uint64 `json:",string"`
Name string
}
@@ -169,7 +169,7 @@ var _ RequestFiller = NewOrganisationEdit()
// Organisation remove request parameters
type OrganisationRemove struct {
ID uint64
ID uint64 `json:",string"`
}
func NewOrganisationRemove() *OrganisationRemove {
@@ -211,7 +211,7 @@ var _ RequestFiller = NewOrganisationRemove()
// Organisation read request parameters
type OrganisationRead struct {
ID uint64
ID uint64 `json:",string"`
}
func NewOrganisationRead() *OrganisationRead {
@@ -256,7 +256,7 @@ var _ RequestFiller = NewOrganisationRead()
// Organisation archive request parameters
type OrganisationArchive struct {
ID uint64
ID uint64 `json:",string"`
}
func NewOrganisationArchive() *OrganisationArchive {

View File

@@ -123,7 +123,7 @@ var _ RequestFiller = NewTeamCreate()
// Team edit request parameters
type TeamEdit struct {
TeamID uint64
TeamID uint64 `json:",string"`
Name string
Members []uint64
}
@@ -171,7 +171,7 @@ var _ RequestFiller = NewTeamEdit()
// Team read request parameters
type TeamRead struct {
TeamID uint64
TeamID uint64 `json:",string"`
}
func NewTeamRead() *TeamRead {
@@ -213,7 +213,7 @@ var _ RequestFiller = NewTeamRead()
// Team remove request parameters
type TeamRemove struct {
TeamID uint64
TeamID uint64 `json:",string"`
}
func NewTeamRemove() *TeamRemove {
@@ -255,7 +255,7 @@ var _ RequestFiller = NewTeamRemove()
// Team archive request parameters
type TeamArchive struct {
TeamID uint64
TeamID uint64 `json:",string"`
}
func NewTeamArchive() *TeamArchive {
@@ -297,8 +297,8 @@ var _ RequestFiller = NewTeamArchive()
// Team move request parameters
type TeamMove struct {
TeamID uint64
OrganisationID uint64
TeamID uint64 `json:",string"`
OrganisationID uint64 `json:",string"`
}
func NewTeamMove() *TeamMove {
@@ -344,8 +344,8 @@ var _ RequestFiller = NewTeamMove()
// Team merge request parameters
type TeamMerge struct {
TeamID uint64
Destination uint64
TeamID uint64 `json:",string"`
Destination uint64 `json:",string"`
}
func NewTeamMerge() *TeamMerge {

View File

@@ -77,7 +77,7 @@ var _ RequestFiller = NewUserSearch()
// User message request parameters
type UserMessage struct {
UserID uint64
UserID uint64 `json:",string"`
Message string
}