views

package
v0.0.0-...-b9360c4 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DiscussionMap is a map of attribute names in result type Discussion indexed
	// by view name.
	DiscussionMap = map[string][]string{
		"default": []string{
			"posts",
		},
	}
	// ThreadedPostMap is a map of attribute names in result type ThreadedPost
	// indexed by view name.
	ThreadedPostMap = map[string][]string{
		"default": []string{
			"id",
			"createdAt",
			"updatedAt",
			"author",
			"replies",
			"body",
			"bookmark",
		},
	}
)

Functions

func ValidateAuthorPhotoView

func ValidateAuthorPhotoView(result *AuthorPhotoView) (err error)

ValidateAuthorPhotoView runs the validations defined on AuthorPhotoView.

func ValidateDiscussion

func ValidateDiscussion(result *Discussion) (err error)

ValidateDiscussion runs the validations defined on the viewed result type Discussion.

func ValidateDiscussionView

func ValidateDiscussionView(result *DiscussionView) (err error)

ValidateDiscussionView runs the validations defined on DiscussionView using the "default" view.

func ValidatePostAuthorView

func ValidatePostAuthorView(result *PostAuthorView) (err error)

ValidatePostAuthorView runs the validations defined on PostAuthorView.

func ValidateThreadedPostView

func ValidateThreadedPostView(result *ThreadedPostView) (err error)

ValidateThreadedPostView runs the validations defined on ThreadedPostView using the "default" view.

Types

type AuthorPhotoView

type AuthorPhotoView struct {
	URL *string
}

AuthorPhotoView is a type that runs validations on a projected type.

type Discussion

type Discussion struct {
	// Type to project
	Projected *DiscussionView
	// View to render
	View string
}

Discussion is the viewed result type that is projected based on a view.

type DiscussionView

type DiscussionView struct {
	Posts []*ThreadedPostView
}

DiscussionView is a type that runs validations on a projected type.

type PostAuthorView

type PostAuthorView struct {
	ID    *int32
	Name  *string
	Photo *AuthorPhotoView
}

PostAuthorView is a type that runs validations on a projected type.

type ThreadedPostView

type ThreadedPostView struct {
	ID        *int64
	CreatedAt *int64
	UpdatedAt *int64
	Author    *PostAuthorView
	Replies   []*ThreadedPostView
	Body      *string
	Bookmark  *string
}

ThreadedPostView is a type that runs validations on a projected type.

Jump to

Keyboard shortcuts

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