model

package
v0.0.0-...-9bca149 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 6, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Content

type Content struct {
	ID            primitive.ObjectID     `bson:"_id" json:"_id" xml:"_id" form:"_id" query:"_id"`
	CreatedAt     time.Time              `bson:"created_at" json:"created_at" xml:"created_at" form:"created_at" query:"created_at"`
	UpdatedAt     time.Time              `bson:"updated_at" json:"updated_at" xml:"updated_at" form:"updated_at" query:"updated_at"`
	ContentTypeID primitive.ObjectID     `bson:"content_type_id" json:"content_type_id" xml:"content_type_id" form:"content_type_id"`
	Title         string                 `bson:"title" json:"title" xml:"title" form:"title" query:"title"`
	Published     *bool                  `bson:"published" json:"published" xml:"published" form:"published" query:"published"`
	Tags          []string               `bson:"tags" json:"tags" xml:"tags" form:"tags" query:"tags"`
	Fields        map[string]interface{} `bson:"fields,inline" json:"fields" xml:"fields" form:"fields" query:"fields"`
}

Content struct

func (*Content) Init

func (c *Content) Init(ct ContentType)

Initialize metadata

type ContentType

type ContentType struct {
	ID          primitive.ObjectID              `bson:"_id" json:"_id" xml:"_id" form:"_id"`
	CreatedAt   time.Time                       `bson:"created_at"`
	UpdatedAt   time.Time                       `bson:"updated_at"`
	TypeName    string                          `bson:"typename" json:"typename" xml:"typename" form:"typename"`
	Collection  string                          `bson:"collection" json:"collection" xml:"collection" form:"collection"`
	Permissions map[string][]primitive.ObjectID `bson:"permissions" json:"permissions" xml:"permissions" form:"permissions"`
	FieldSchema map[string]interface{}          `bson:"field_schema" json:"field_schema" xml:"field_schema" form:"field_schema"` // not used yet. Could be used for introducing a Validator on Collection Creation.
}

ContentType struct

func (*ContentType) Init

func (ct *ContentType) Init()

Initialize metadata

type ContentTypeUpdate

type ContentTypeUpdate struct {
	TypeName    string                 `bson:"typename,omitempty" json:"typename" xml:"typename" form:"typename"`
	Collection  string                 `bson:"collection,omitempty" json:"collection" xml:"collection" form:"collection"`
	Permissions map[string][]string    `bson:"permissions,omitempty" json:"permissions" xml:"permissions" form:"permissions"`
	FieldSchema map[string]interface{} `bson:"field_schema,omitempty" json:"field_schema" xml:"field_schema" form:"field_schema"`
}

Fields that can be updated through API endpoints

type ContentUpdate

type ContentUpdate struct {
	Title     string                 `bson:"title,omitempty" json:"title" xml:"title" form:"title"`
	Published *bool                  `bson:"published,omitempty" json:"published" xml:"published" form:"published"` // empty value is `nil` pointer, so it can be differentiated from `false` value for `omitempty`flag
	Tags      []string               `bson:"tags,omitempty" json:"tags" xml:"tags" form:"tags"`
	Fields    map[string]interface{} `bson:"fields,inline,omitempty" json:"fields" xml:"fields" form:"fields"`
}

Fields that can be updated through API endpoints

type Role

type Role struct {
	ID   primitive.ObjectID `bson:"_id,omitempty" json:"_id" xml:"_id" form:"_id"`
	Tag  string             `bson:"tag,omitempty" json:"tag" xml:"tag" form:"tag"`
	Name string             `bson:"name,omitempty" json:"name" xml:"name" form:"name"`
}

Saves the user-IDs of users with this role

func (*Role) Init

func (r *Role) Init()

Initialize metadata

type User

type User struct {
	ID        primitive.ObjectID   `bson:"_id" json:"_id" xml:"_id" form:"_id" query:"_id"`
	CreatedAt time.Time            `bson:"created_at" json:"created_at" xml:"created_at" form:"created_at" query:"created_at"`
	UpdatedAt time.Time            `bson:"updated_at" json:"updated_at" xml:"updated_at" form:"updated_at" query:"updated_at"`
	Username  string               `bson:"username" json:"username" xml:"username" form:"username" query:"username"`
	Email     string               `bson:"email" json:"email" xml:"email" form:"email" query:"id"`
	Password  string               `bson:"password" json:"password" xml:"password" form:"password"`
	Names     string               `bson:"names" json:"names" xml:"names" form:"names" query:"names"`
	Roles     []primitive.ObjectID `bson:"roles" json:"roles" xml:"roles" form:"roles" query:"roles"`
}

User struct

func (*User) Init

func (u *User) Init()

Initialize metadata

type UserUpdate

type UserUpdate struct {
	Username string   `bson:"username,omitempty" json:"username" xml:"username" form:"username"`
	Email    string   `bson:"email,omitempty" json:"email" xml:"email" form:"email"`
	Password string   `bson:"password,omitempty" json:"password" xml:"password" form:"password"`
	Names    string   `bson:"names,omitempty" json:"names" xml:"names" form:"names"`
	Roles    []string `bson:"roles,omitempty" json:"roles" xml:"roles" form:"roles"`
}

Fields that can be updated through API endpoints

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL