Documentation ¶
Index ¶
- Variables
- func BsonA(vals []any) bson.A
- func BsonD(k string, v any) bson.D
- func BsonE(k string, v any) bson.E
- func BsonLookup(col, pk, fk, as string, let bson.D, pipe bson.A) bson.D
- func BsonOperWithArray(op string, v []any) bson.D
- func BsonOperator(op string, k string, v any) bson.D
- func BsonProjection(keys []string, val BSONProjectValue) bson.D
- func BsonProjectionMap[T comparable](vals map[string]T) bson.D
- func ComposeBsonD[T comparable](vals map[string]T) bson.D
- func QrStrAddCreatorOnThread() bson.D
- func QrStrEntireThread(slug string, cfg *types.QueryCtx) bson.A
- func QrStrFindHashCollision(hash string, method string) bson.D
- func QrStrLookupAccount(pk string) bson.D
- func QrStrLookupAccountRecentIdentities(account_id primitive.ObjectID) bson.A
- func QrStrLookupArticle(slug string) bson.A
- func QrStrLookupArticleAuthor(pk string) bson.D
- func QrStrLookupArticleList(cfg *types.QueryCtx) bson.A
- func QrStrLookupAssets(pk string) bson.D
- func QrStrLookupIdentity(pk string) bson.D
- func QrStrLookupPost(threadID primitive.ObjectID, postNum int, threadSlug, boardShort string) bson.A
- func QrStrLookupPosts(sortBy string, sortDir int, limit int) bson.D
- func QrStrLookupThread(slug string, boardID primitive.ObjectID, boardShort string) bson.A
- func QrStrLookupThreads(boardID primitive.ObjectID, cfg *types.QueryCtx) (bson.A, error)
- func StartPaginatedPipe(mkey string, mval primitive.ObjectID, cfg *types.QueryCtx) (bson.A, error)
- type BSONProjectValue
Constants ¶
This section is empty.
Variables ¶
var ( ASSET_SRC_PUBLIC_INCLUDE_FIELDS = []string{"details", "asset_type"} // this is the projection for after source lookup ASSET_PUBLIC_PROJECTION = map[string]string{ "avatar": "$source.details.avatar", "source": "$source.details.source", "asset_type": "$source.asset_type", "file_name": "$file_name", "description": "$description", "tags": "$tags", "created_at": "$created_at", "updated_at": "$updated_at", } )
var (
PUBLIC_INCLUDE_FIELDS = []string{"name", "style", "role", "status"}
)
Functions ¶
func BsonA ¶
Create a bson.A - takes an array of any type, each will be inserted into the bson.A as itself
func BsonLookup ¶
Creates a $lookup bson obj with given parameters
func BsonOperWithArray ¶
same as BsonOperator but for operators that take an array instead of bson
func BsonOperator ¶
creates bson for pipeline operators
func BsonProjection ¶
func BsonProjection(keys []string, val BSONProjectValue) bson.D
Creates a bson projection with keys either included or excluded with inclusion, exclusions are explicit. the inverse is true of exclusions
func BsonProjectionMap ¶
func BsonProjectionMap[T comparable](vals map[string]T) bson.D
creates a projection map from a map[string]T - for more specific control over the projection
func ComposeBsonD ¶
func ComposeBsonD[T comparable](vals map[string]T) bson.D
Creates a bson.D including the given key/value pair map as bson.E values
func QrStrAddCreatorOnThread ¶
returns the bson.D pipeline obj to unflatten the creator field back into an object
func QrStrEntireThread ¶
a single thread with all posts populated
func QrStrFindHashCollision ¶
Checksum hash collision query - checks source and avatar for given hash using specified method
func QrStrLookupAccountRecentIdentities ¶
10 most recent account identities
func QrStrLookupArticle ¶
single article with populated comments
func QrStrLookupArticleAuthor ¶
article author lookup
func QrStrLookupArticleList ¶
list of paginated articles
func QrStrLookupAssets ¶
func QrStrLookupIdentity ¶
returns a pipeline object that can be used as an internal pipeline for a $lookup or other aggregate pk is the field name to reference the lookup from
func QrStrLookupPost ¶
func QrStrLookupPost(threadID primitive.ObjectID, postNum int, threadSlug, boardShort string) bson.A
singular post lookup
func QrStrLookupPosts ¶
Thread posts aggregation lookup pipeline
func QrStrLookupThread ¶
singular thread lookup - models in the shape of post
func QrStrLookupThreads ¶
List of paginated thread previews for a board
Types ¶
type BSONProjectValue ¶
type BSONProjectValue int
const ( BSONProjectInclude BSONProjectValue = 1 BSONProjectExclude BSONProjectValue = -1 )