models

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Nov 18, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Comment

type Comment struct {
	ID        string    `gql:"id,type:ID,description:Comment ID"`
	PostID    string    `gql:"postID,type:ID,description:Associated post ID"`
	Post      *Post     `gql:"post,forceResolver,description:The post this comment belongs to"`
	AuthorID  string    `gql:"authorID,type:ID,description:Comment author's user ID"`
	Author    *User     `gql:"author,forceResolver,description:Comment author"`
	Content   string    `gql:"content,required,description:Comment content"`
	CreatedAt time.Time `gql:"createdAt,type:DateTime,forceResolver,description:Creation timestamp"`
	UpdatedAt time.Time `gql:"updatedAt,type:DateTime,forceResolver,description:Last update timestamp"`
}

*

  • @gqlType(description:"A comment on a post")
  • @gqlInput(name:"CreateCommentInput")

type Post

type Post struct {
	ID          string     `gql:"id,type:ID,description:Unique post identifier"`
	Title       string     `gql:"title,required,description:Post title"`
	Slug        string     `gql:"slug,required,description:URL-friendly slug"`
	Content     string     `gql:"content,required,description:Post content (markdown)"`
	Excerpt     *string    `gql:"excerpt,optional,description:Short excerpt"`
	AuthorID    string     `gql:"authorID,type:ID,description:Author's user ID"`
	Author      *User      `gql:"author,forceResolver,description:Post author"`
	Tags        []string   `gql:"tags,description:Post tags"`
	Status      PostStatus `gql:"status,description:Post status"`
	ViewCount   int        `gql:"viewCount,description:Number of views"`
	PublishedAt *time.Time `gql:"publishedAt,type:DateTime,optional,description:Publication timestamp"`
	CreatedAt   time.Time  `gql:"createdAt,type:DateTime,forceResolver,description:Creation timestamp"`
	UpdatedAt   time.Time  `gql:"updatedAt,type:DateTime,forceResolver,description:Last update timestamp"`
}

*

  • @gqlType(name:"Post",description:"A blog post")
  • @gqlInput(name:"CreatePostInput")
  • @gqlInput(name:"UpdatePostInput")

type PostStatus

type PostStatus string

*

  • @gqlEnum(description:"Post publication status")
const (
	PostStatusDraft     PostStatus = "DRAFT"
	PostStatusPublished PostStatus = "PUBLISHED"
	PostStatusArchived  PostStatus = "ARCHIVED"
)

type User

type User struct {
	ID        string    `gql:"id,type:ID,description:Unique user identifier"`
	Email     string    `gql:"email,required,description:User's email address"`
	Username  string    `gql:"username,required,description:Unique username"`
	FirstName string    `gql:"firstName,description:User's first name"`
	LastName  string    `gql:"lastName,description:User's last name"`
	Bio       *string   `gql:"bio,optional,description:User biography"`
	Avatar    *string   `gql:"avatar,optional,description:Avatar URL"`
	IsActive  bool      `gql:"isActive,description:Whether the user is active"`
	Role      UserRole  `gql:"role,description:User's role in the system"`
	CreatedAt time.Time `gql:"createdAt,type:DateTime,forceResolver,description:Account creation timestamp"`
	UpdatedAt time.Time `gql:"updatedAt,type:DateTime,forceResolver,description:Last update timestamp"`
}

*

  • @gqlType(name:"User",description:"Represents a user in the system")
  • @gqlInput(name:"CreateUserInput")
  • @gqlInput(name:"UpdateUserInput")

type UserProfile

type UserProfile struct {
	UserID      string  `gql:"userId,type:ID,required,description:Associated user ID"`
	DisplayName string  `gql:"displayName,description:Display name"`
	Location    *string `gql:"location,optional,description:User's location"`
	Website     *string `gql:"website,optional,description:User's website URL"`
	Twitter     *string `gql:"twitter,optional,description:Twitter handle"`
	GitHub      *string `gql:"github,optional,description:GitHub username"`
}

*

  • @gqlType(description:"User profile information")

type UserRole

type UserRole string

*

  • @gqlEnum(description:"User role in the system")
const (
	UserRoleAdmin     UserRole = "ADMIN"
	UserRoleModerator UserRole = "MODERATOR"
	UserRoleUser      UserRole = "USER"
	UserRoleGuest     UserRole = "GUEST"
)

Jump to

Keyboard shortcuts

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