web

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2023 License: MIT Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewExecutableSchema

func NewExecutableSchema(cfg Config) graphql.ExecutableSchema

NewExecutableSchema creates an ExecutableSchema from the ResolverRoot interface.

func RunServer

func RunServer(addr string)

Types

type BlogPostResolver

type BlogPostResolver interface {
	ID(ctx context.Context, obj *model.Post) (string, error)
	Author(ctx context.Context, obj *model.Post) (*model.User, error)
	CreatedAt(ctx context.Context, obj *model.Post) (*library.Datetime, error)
	ModifiedAt(ctx context.Context, obj *model.Post) (*library.Datetime, error)
	Type(ctx context.Context, obj *model.Post) (global.BlogPostType, error)

	Category(ctx context.Context, obj *model.Post) (*model.Category, error)
}

type BlogPostSeriesResolver

type BlogPostSeriesResolver interface {
	Posts(ctx context.Context, obj *model.PostSeries) ([]*model.Post, error)
	Children(ctx context.Context, obj *model.PostSeries) ([]*model.PostSeries, error)
}

type BlogUserResolver

type BlogUserResolver interface {
	ID(ctx context.Context, obj *model.User) (string, error)
}

type ComplexityRoot

type ComplexityRoot struct {
	BlogCategory struct {
		Name func(childComplexity int) int
		URL  func(childComplexity int) int
	}

	BlogLoginResponse struct {
		Token func(childComplexity int) int
		User  func(childComplexity int) int
	}

	BlogPost struct {
		Author     func(childComplexity int) int
		Category   func(childComplexity int) int
		Content    func(childComplexity int) int
		CreatedAt  func(childComplexity int) int
		ID         func(childComplexity int) int
		Markdown   func(childComplexity int) int
		Menu       func(childComplexity int) int
		ModifiedAt func(childComplexity int) int
		Name       func(childComplexity int) int
		Tags       func(childComplexity int) int
		Title      func(childComplexity int) int
		Type       func(childComplexity int) int
	}

	BlogPostSeries struct {
		Children func(childComplexity int) int
		Key      func(childComplexity int) int
		Posts    func(childComplexity int) int
		Remark   func(childComplexity int) int
	}

	BlogUser struct {
		ID       func(childComplexity int) int
		Username func(childComplexity int) int
	}

	GeneralUser struct {
		LockPrefixes func(childComplexity int) int
		Name         func(childComplexity int) int
	}

	Lock struct {
		ExpiresAt func(childComplexity int) int
		Name      func(childComplexity int) int
		OwnerID   func(childComplexity int) int
	}

	Mutation struct {
		AcquireLock          func(childComplexity int, lockName string, durationSec int, isRenewal *bool) int
		BlogAmendPost        func(childComplexity int, post global.NewBlogPost) int
		BlogCreatePost       func(childComplexity int, post global.NewBlogPost) int
		BlogLogin            func(childComplexity int, account string, password string) int
		CreateGeneralToken   func(childComplexity int, username string, durationSec int) int
		TelegramMonitorAlert func(childComplexity int, typeArg string, token string, msg string) int
	}

	PostInfo struct {
		Total func(childComplexity int) int
	}

	Query struct {
		BlogPostCategories   func(childComplexity int) int
		BlogPostInfo         func(childComplexity int) int
		BlogPosts            func(childComplexity int, page *global.Pagination, tag string, categoryURL *string, length int, name string, regexp string) int
		BlogTwitterCard      func(childComplexity int, name string) int
		GetBlogPostSeries    func(childComplexity int, page *global.Pagination, key string) int
		Hello                func(childComplexity int) int
		Lock                 func(childComplexity int, name string) int
		LockPermissions      func(childComplexity int, username string) int
		TelegramAlertTypes   func(childComplexity int, page *global.Pagination, name string) int
		TelegramMonitorUsers func(childComplexity int, page *global.Pagination, name string) int
		TwitterStatues       func(childComplexity int, page *global.Pagination, tweetID string, username string, viewerID string, sort *global.Sort, topic string, regexp string) int
		TwitterThreads       func(childComplexity int, tweetID string) int
		WhoAmI               func(childComplexity int) int
	}

	TelegramAlertType struct {
		CreatedAt  func(childComplexity int) int
		ID         func(childComplexity int) int
		ModifiedAt func(childComplexity int) int
		Name       func(childComplexity int) int
		SubUsers   func(childComplexity int) int
	}

	TelegramUser struct {
		CreatedAt  func(childComplexity int) int
		ID         func(childComplexity int) int
		ModifiedAt func(childComplexity int) int
		Name       func(childComplexity int) int
		SubAlerts  func(childComplexity int) int
		TelegramID func(childComplexity int) int
	}

	Tweet struct {
		CreatedAt      func(childComplexity int) int
		ID             func(childComplexity int) int
		Images         func(childComplexity int) int
		IsQuoteStatus  func(childComplexity int) int
		IsRetweeted    func(childComplexity int) int
		QuotedStatus   func(childComplexity int) int
		ReplyTo        func(childComplexity int) int
		Replys         func(childComplexity int) int
		RetweetedTweet func(childComplexity int) int
		Text           func(childComplexity int) int
		Topics         func(childComplexity int) int
		URL            func(childComplexity int) int
		User           func(childComplexity int) int
		Viewers        func(childComplexity int) int
	}

	TwitterUser struct {
		Description func(childComplexity int) int
		ID          func(childComplexity int) int
		Name        func(childComplexity int) int
		ScreenName  func(childComplexity int) int
	}
}

type Config

type Config struct {
	Resolvers  ResolverRoot
	Directives DirectiveRoot
	Complexity ComplexityRoot
}

type DirectiveRoot

type DirectiveRoot struct {
}

type LockResolver

type LockResolver interface {
	ExpiresAt(ctx context.Context, obj *model1.Lock) (*library.Datetime, error)
}

type MutationResolver

type MutationResolver interface {
	BlogCreatePost(ctx context.Context, post global.NewBlogPost) (*model.Post, error)
	BlogLogin(ctx context.Context, account string, password string) (*global.BlogLoginResponse, error)
	BlogAmendPost(ctx context.Context, post global.NewBlogPost) (*model.Post, error)
	TelegramMonitorAlert(ctx context.Context, typeArg string, token string, msg string) (*model2.AlertTypes, error)
	AcquireLock(ctx context.Context, lockName string, durationSec int, isRenewal *bool) (bool, error)
	CreateGeneralToken(ctx context.Context, username string, durationSec int) (string, error)
}

type QueryResolver

type QueryResolver interface {
	Hello(ctx context.Context) (string, error)
	WhoAmI(ctx context.Context) (*model.User, error)
	TwitterStatues(ctx context.Context, page *global.Pagination, tweetID string, username string, viewerID string, sort *global.Sort, topic string, regexp string) ([]*model3.Tweet, error)
	TwitterThreads(ctx context.Context, tweetID string) ([]*model3.Tweet, error)
	BlogPosts(ctx context.Context, page *global.Pagination, tag string, categoryURL *string, length int, name string, regexp string) ([]*model.Post, error)
	BlogPostInfo(ctx context.Context) (*dto.PostInfo, error)
	BlogPostCategories(ctx context.Context) ([]*model.Category, error)
	GetBlogPostSeries(ctx context.Context, page *global.Pagination, key string) ([]*model.PostSeries, error)
	BlogTwitterCard(ctx context.Context, name string) (string, error)
	TelegramMonitorUsers(ctx context.Context, page *global.Pagination, name string) ([]*model2.Users, error)
	TelegramAlertTypes(ctx context.Context, page *global.Pagination, name string) ([]*model2.AlertTypes, error)
	Lock(ctx context.Context, name string) (*model1.Lock, error)
	LockPermissions(ctx context.Context, username string) ([]*global.GeneralUser, error)
}

type Resolver

type Resolver struct{}

func (*Resolver) BlogPost

func (r *Resolver) BlogPost() BlogPostResolver

func (*Resolver) BlogPostSeries

func (r *Resolver) BlogPostSeries() BlogPostSeriesResolver

func (*Resolver) BlogUser

func (r *Resolver) BlogUser() BlogUserResolver

func (*Resolver) Lock

func (r *Resolver) Lock() LockResolver

func (*Resolver) Mutation

func (r *Resolver) Mutation() MutationResolver

func (*Resolver) Query

func (r *Resolver) Query() QueryResolver

func (*Resolver) TelegramAlertType

func (r *Resolver) TelegramAlertType() TelegramAlertTypeResolver

func (*Resolver) TelegramUser

func (r *Resolver) TelegramUser() TelegramUserResolver

func (*Resolver) Tweet

func (r *Resolver) Tweet() TweetResolver

func (*Resolver) TwitterUser

func (r *Resolver) TwitterUser() TwitterUserResolver

type ResolverRoot

type ResolverRoot interface {
	BlogPost() BlogPostResolver
	BlogPostSeries() BlogPostSeriesResolver
	BlogUser() BlogUserResolver
	Lock() LockResolver
	Mutation() MutationResolver
	Query() QueryResolver
	TelegramAlertType() TelegramAlertTypeResolver
	TelegramUser() TelegramUserResolver
	Tweet() TweetResolver
	TwitterUser() TwitterUserResolver
}

type TelegramAlertTypeResolver

type TelegramAlertTypeResolver interface {
	ID(ctx context.Context, obj *model2.AlertTypes) (string, error)
	CreatedAt(ctx context.Context, obj *model2.AlertTypes) (*library.Datetime, error)
	ModifiedAt(ctx context.Context, obj *model2.AlertTypes) (*library.Datetime, error)

	SubUsers(ctx context.Context, obj *model2.AlertTypes) ([]*model2.Users, error)
}

type TelegramUserResolver

type TelegramUserResolver interface {
	ID(ctx context.Context, obj *model2.Users) (string, error)
	CreatedAt(ctx context.Context, obj *model2.Users) (*library.Datetime, error)
	ModifiedAt(ctx context.Context, obj *model2.Users) (*library.Datetime, error)
	TelegramID(ctx context.Context, obj *model2.Users) (string, error)

	SubAlerts(ctx context.Context, obj *model2.Users) ([]*model2.AlertTypes, error)
}

type TweetResolver

type TweetResolver interface {
	CreatedAt(ctx context.Context, obj *model3.Tweet) (*library.Datetime, error)

	ReplyTo(ctx context.Context, obj *model3.Tweet) (*model3.Tweet, error)
	Replys(ctx context.Context, obj *model3.Tweet) ([]*model3.Tweet, error)
	IsQuoteStatus(ctx context.Context, obj *model3.Tweet) (bool, error)
	QuotedStatus(ctx context.Context, obj *model3.Tweet) (*model3.Tweet, error)

	URL(ctx context.Context, obj *model3.Tweet) (string, error)
	Images(ctx context.Context, obj *model3.Tweet) ([]string, error)
	Viewers(ctx context.Context, obj *model3.Tweet) ([]*model3.User, error)
}

type TwitterUserResolver

type TwitterUserResolver interface {
	Description(ctx context.Context, obj *model3.User) (string, error)
}

Directories

Path Synopsis
blog
dao
dto
general
dao
telegram
dao
dto
service
Package telegram is telegram server.
Package telegram is telegram server.
twitter
dao
Package dao implements the Twitter database
Package dao implements the Twitter database
dto
service
Package service service for twitter API
Package service service for twitter API

Jump to

Keyboard shortcuts

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