Documentation ¶
Index ¶
- Constants
- Variables
- func IsValidStruct(result *StoryStruct) error
- func ReflexCache()
- func SetLastStories()
- func SetTopFeed()
- func TokenBlackList(token, idtoken string) bool
- type FeedStrcture
- type PostController
- func (v *PostController) DelatePost(c *gin.Context)
- func (v *PostController) Feed(c *gin.Context)
- func (v *PostController) FeedFast() ([]FeedStrcture, error)
- func (v *PostController) FindPost(c *gin.Context)
- func (v *PostController) Initialize(c *gin.Context)
- func (v *PostController) InsertPost(c *gin.Context)
- func (v *PostController) MyPosts(c *gin.Context)
- func (v *PostController) Post(c *gin.Context)
- func (v *PostController) RecommendedPost(c *gin.Context)
- func (v *PostController) SetCollection(Collection string) *PostController
- func (v *PostController) SetTop() ([]StoryStruct, error)
- func (v *PostController) UpdatePost(c *gin.Context)
- func (*PostController) UploadImage(c *gin.Context)
- func (v *PostController) Visibility(c *gin.Context)
- type Queryconf
- func (v *Queryconf) Addviews(id primitive.ObjectID) error
- func (v *Queryconf) DelatePost(id primitive.ObjectID) error
- func (v *Queryconf) GetFeed(next int64, query bson.M, limit int64) ([]FeedStrcture, error)
- func (v *Queryconf) GetMetaPost(objectId primitive.ObjectID) (FeedStrcture, error)
- func (v *Queryconf) GetTOP() ([]StoryStruct, error)
- func (v *Queryconf) ModelGetArticle(objectId primitive.ObjectID) (StoryStruct, error)
- func (v *Queryconf) ModelInsertPost(result *StoryStruct) (*mongo.InsertOneResult, error)
- func (v *Queryconf) ModelUpdate(dataInsert *StoryStruct, objectId primitive.ObjectID) (bool, error)
- type StoryStruct
- type Top50
Constants ¶
View Source
const DefaultLimit int64 = 10
Variables ¶
View Source
var Blogs = InitControllerPost()
View Source
var FastFeed []FeedStrcture
Stores the feed in a variable allowing for faster access
View Source
var StoryCacheVar *[]StoryStruct
Stores the last 50 most viewed stories allowing for quicker access
Functions ¶
func IsValidStruct ¶
func IsValidStruct(result *StoryStruct) error
valid if the stories' structure is valid
func TokenBlackList ¶
gets if the token is blacklisted from some database
Types ¶
type FeedStrcture ¶
type FeedStrcture struct { Title string `bson:"Title,omitempty" ` Author string `bson:"Author,omitempty" ` ID string `bson:"_id,omitempty" ` Date time.Time `bson:"Date,omitempty"` Imagen string `bson:"Imagen,omitempty"` Description string `bson:"Description,omitempty"` Visible bool `bson:"Visible,omitempty"` }
Feed structure
type PostController ¶
func (*PostController) DelatePost ¶
func (v *PostController) DelatePost(c *gin.Context)
func (*PostController) Feed ¶
func (v *PostController) Feed(c *gin.Context)
func (*PostController) FeedFast ¶
func (v *PostController) FeedFast() ([]FeedStrcture, error)
func (*PostController) FindPost ¶
func (v *PostController) FindPost(c *gin.Context)
func (*PostController) Initialize ¶
func (v *PostController) Initialize(c *gin.Context)
func (*PostController) InsertPost ¶
func (v *PostController) InsertPost(c *gin.Context)
func (*PostController) MyPosts ¶
func (v *PostController) MyPosts(c *gin.Context)
func (*PostController) Post ¶
func (v *PostController) Post(c *gin.Context)
func (*PostController) RecommendedPost ¶
func (v *PostController) RecommendedPost(c *gin.Context)
func (*PostController) SetCollection ¶
func (v *PostController) SetCollection(Collection string) *PostController
change collection in the database
func (*PostController) SetTop ¶
func (v *PostController) SetTop() ([]StoryStruct, error)
func (*PostController) UpdatePost ¶
func (v *PostController) UpdatePost(c *gin.Context)
func (*PostController) UploadImage ¶
func (*PostController) UploadImage(c *gin.Context)
func (*PostController) Visibility ¶
func (v *PostController) Visibility(c *gin.Context)
type Queryconf ¶
type Queryconf struct {
Collection string
}
func (*Queryconf) DelatePost ¶
Delete a specific post
func (*Queryconf) GetMetaPost ¶
func (v *Queryconf) GetMetaPost(objectId primitive.ObjectID) (FeedStrcture, error)
Returns the basic data of a post
func (*Queryconf) GetTOP ¶
func (v *Queryconf) GetTOP() ([]StoryStruct, error)
Get the last ten posts most viewed
func (*Queryconf) ModelGetArticle ¶
func (v *Queryconf) ModelGetArticle(objectId primitive.ObjectID) (StoryStruct, error)
Gets a post from an id
func (*Queryconf) ModelInsertPost ¶
func (v *Queryconf) ModelInsertPost(result *StoryStruct) (*mongo.InsertOneResult, error)
Insert a post from a structure
func (*Queryconf) ModelUpdate ¶
Update a post from a structure
type StoryStruct ¶
type StoryStruct struct { Title string `bson:"Title,omitempty"` Content string `bson:"Content,omitempty"` Visible bool `bson:"Visible"` Tags []string `bson:"Tags,omitempty"` Date time.Time `bson:"Date,omitempty" ` Imagen string `bson:"Imagen,omitempty"` Status string `bson:"Status,omitempty"` Author string `bson:"Author,omitempty"` Description string `bson:"Description,omitempty"` Password string `bson:"Password"` UrlImageFound []string `bson:"UrlImageFound"` Views int64 `bson:"Views"` ID string `bson:"_id,omitempty" ` Referal string `bson:"Referal,omitempty"` Folder string `bson:"Folder,omitempty"` }
Complete structure of the stories
type Top50 ¶
type Top50 struct {
Top []StoryStruct
}
Click to show internal directories.
Click to hide internal directories.