<!DOCTYPE html> <html style><!-- Page saved with SingleFile url: http://localhost:8080/pkg/rockfic.com/orm/ saved date: Sat Sep 14 2024 17:57:52 GMT-0400 (Eastern Daylight Time) --> <meta charset=utf-8> <meta name=viewport content="width=device-width, initial-scale=1"> <meta name=theme-color content=#375EAB> <title>orm - Go Documentation Server</title> <style>body { margin: 0; font-family: Arial, sans-serif; background-color: #fff; line-height: 1.3; text-align: center; color: #222 } pre, code { font-family: Menlo, monospace; font-size: 0.875rem } pre { line-height: 1.4; overflow-x: auto } pre .comment { color: #006600 } a { color: #375eab; text-decoration: none } a:hover, .exampleHeading .text:hover, .expandAll:hover { text-decoration: underline } p, li { max-width: 50rem; word-wrap: break-word } p, pre, ul { margin: 1.25rem } pre { background: #efefef; padding: 0.625rem; border-radius: 0.3125rem } h1, h2, h3 { margin: 1.25rem 0 1.25rem; padding: 0; color: #375eab; font-weight: bold } h1 { font-size: 1.75rem; line-height: 1 } h1 .text-muted { color: #777 } h2 { font-size: 1.25rem; background: #e0ebf5; padding: 0.5rem; line-height: 1.25; font-weight: normal; overflow: auto; overflow-wrap: break-word } h2 a { font-weight: bold } h3 { font-size: 1.25rem; line-height: 1.25; overflow: auto; overflow-wrap: break-word } h3 { margin: 1.25rem 0.3125rem } dl { margin: 1.25rem } dd { margin: 0 0 0 1.25rem } dl, dd { font-size: 0.875rem } #pkg-index h3 { font-size: 1rem } .pkg-dir { padding: 0 0.625rem } .pkg-dir table { border-collapse: collapse; border-spacing: 0 } .pkg-name { padding-right: 0.625rem } .top-heading { float: left; padding: 1.313rem 0; font-size: 1.25rem; font-weight: normal } .top-heading a { color: #222; text-decoration: none } div#topbar { background: #e0ebf5; height: 4rem; overflow: hidden } div#page { width: 100% } div#page > .container, div#topbar > .container { text-align: left; margin-left: auto; margin-right: auto; padding: 0 1.25rem } div#page.wide > .container, div#topbar.wide > .container { max-width: none } div#footer { text-align: center; color: #666; font-size: 0.875rem; margin: 2.5rem 0 } input#search { padding: 0.625rem; text-decoration: none; font-size: 1rem; border-radius: 0.3125rem } input#search { border: 0.0625rem solid #375eab } div#menu { text-align: right; padding: 0.625rem; white-space: nowrap; max-height: 0; -moz-transition: max-height 0.25s linear; transition: max-height 0.25s linear; width: 100% } ::-webkit-input-placeholder { color: #7f7f7f; opacity: 1 } ::placeholder { color: #7f7f7f; opacity: 1 } #menu .search-box { display: inline-flex; width: 8.75rem } input#search { background: white; color: #222; box-sizing: border-box; -webkit-appearance: none; border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: 0; margin-right: 0; flex-grow: 1; max-width: 100%; min-width: 5.625rem } input#search:-moz-ui-invalid { box-shadow: unset } input#search + button { display: inline; font-size: 1em; background-color: #375eab; color: white; border: 0.0625rem solid #375eab; border-top-left-radius: 0; border-top-right-radius: 0.3125rem; border-bottom-left-radius: 0; border-bottom-right-radius: 0.3125rem; margin-left: 0; cursor: pointer } input#search + button span { display: flex } input#search + button svg { fill: white } @supports (--c:0) { [style*="--aspect-ratio-padding:"] { position: relative; overflow: hidden; padding-top: var(--aspect-ratio-padding) } [style*="--aspect-ratio-padding:"] > * { position: absolute; top: 0; left: 0; width: 100%; height: 100% } } .toggleButton { cursor: pointer } .toggleVisible > .expanded { display: block } h2 { clear: right } @media (max-width: 58.125em) { #heading-wide { display: none } } @media (max-width: 47.5em) { } @media (min-width: 43.75em) and (max-width: 62.5em) { input#search { font-size: 0.875rem } } @media (max-width: 43.75em) { body { font-size: 0.9375rem } pre, code { font-size: 0.866rem } div#page > .container { padding: 0 0.625rem } div#topbar { height: auto; padding: 0.625rem } div#topbar > .container { padding: 0 } #heading-wide { display: block } .top-heading { float: none; padding: 0.75rem } div#menu { padding: 0; text-align: left; float: left } #menu .search-box { display: flex; width: 100% } p, pre, ul { margin: 0.625rem } .pkg-synopsis { display: none } } @media (max-width: 30em) { #heading-wide { display: none } }</style> <meta name=referrer content=no-referrer> <link type=image/x-icon rel="shortcut icon" href="data:image/x-icon;base64,AAABAAIAICAAAAEAIACoEAAAJgAAABAQAA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/+4Xb//uF2//7hdv/awWX/xrBc/8awXP/fxmj//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2/1ROOP9UTjj/AAAAAAAAAAAAAAAAAAAAAFROOP9UTjj//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2/+bhzf/7/P//+/z//+LavP/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb/VE44/1ROOP8AAAAAAAAAAAAAAAAAAAAAVE44/1ROOP/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//jcc//mzGv/8fDq//v8///7/P//6eXX/+TKav/43HP//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv9UTjj/VE44/wAAAAAAAAAAAAAAAAAAAABUTjj/VE44//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/73nX/qZpg/5STfP+Un7f/mqbB/5unwv+TnLD/lpN6/7CfX//+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2/1ROOP9UTjj/AAAAAAAAAAAAAAAAAAAAAFROOP9UTjj//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//jcef92jcD/dIzD/3SMw/90jMP/dIzD/3SMw/90jMP/fI+3//7hdv/+4Xb//uF2//7hdv/+4Xb//uF2//7hdv/+4Xb/VE44/1ROOP8AAAAAAAAAAAAAAAAAAAAAVE44/1ROOP/+4Xb//uF2//7hdv/+4nv//u6x///32f//+eP///XP/6Cptf90jMP/U2KF/zM5Sf81PEz/WWqQ/3SMw/+wtLL///LD///zyf/+7q///uN///7hdv/+4Xb//uF2//7hdv9UTjj/VE44/wAAAAAAAAAAAAAAAAAAAABUTjj/VE44//7hdv/+4Xb//uSE///66P///////////////////////v///8zKvf8fICP/HyAj/x8gI/8nKCr/3d7X/////////////////////////fT//uiY//7hdv/+4Xb//uF2/1ROOP9UTjj/AAAAAAAAAAAAAAAAAAAAAFROOP9UTjj//uF2//7hdv//+N7//////////////////////////////////////6CXdv9MRzT/UUs1/7Otmv///////////////////////////////////ff//uSF//7hdv/+4Xb/VE44/1ROOP8AAAAAAAAAAAAAAAAAAAAAVE4481ROOP/43HT//uiV///////////////////////29vb/X2Fj/ygqLv97fX///vvv//7hd//+55H//////////////////////9TU1f9AQUT/MTI2/7O0tf//8cH//uF2//jcdP9UTjj/VE448wAAAAAAAAAAAAAAAAAAAABUTjjaVE44/+vQb//+7rP//////////////////////5eYmv8RExf/ERMX/xETF//BwsP//uWG//7usf//////////////////////UFFU/xETF/8RExf/HyEl//z13f/+4Xb/6tBv/1ROOP9TTjjZAAAAAAAAAAAAAAAAAAAAAFVPN69UTjj/yrVj//7vtP//////////////////////lpaY/xETF/8RExf/ERMX/8DAwf/+5Yf//u6x//////////////////////9PUFP/ERMX/xETF/8eICT/+/Tc//7hdv/Js2L/VE44/1ROOLEAAAAAAAAAAAAAAABUTjlVV1I59JCBTv/iyWz//uiX///////////////////////19fX/W1xf/yUmKv92d3n//vvx//7hd//+55P//////////////////////9HS0v87PUD/LC4x/7Cwsv//8sL//uF2/9jAaP94bUX/VE44+FRPOWcAAAAAVEw5Q1dQOf7Su2b/7dJw//zfdv/94Hb///jg///////////////////////////////////////+7rP//uF2//7hdv//99n///////////////////////////////////34//7lhv/+4Xb//uF2//fbc/+ikVT/VE44/1VPOFdVTji7gnZJ//PYc/+djVP/nY5S//bac//944T///rq//////////////////////////////TL//7hd//+4Xb//uF2//7jgf//+OD////////////////////////99v/+6Zr//uB2/9a+Z/+YiVH/sZ9Z//XZc/9UTjj/VU440FRPOOBrYkD/+t50//nddf/+4Xb/ybNi/5KDTv/123n//u+0///33f//+eX///XS//7qoP/+4Xb//uF2//7hdv/+4Xb//uF2//7hd//+66P///PH///0zP/+7rP//uOA//XZc/+hkVT/6c9u//fbc//t0nD/28Np/1ROOP9UTjj1VU43wVROOP9+ckf/sqBb/4x+Tf9UTjj/VE44/2hfP//ArF//+dx0//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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAgBBkZGRkZGRkZGRkZGQQgIAQZGRkZGRkZGRkZGRkEICAEGRkZGRkZGRkZGRkZBCAgBBkZGRkZGRkZGRkZGQQgIAQZGRkZGRkZGRkZGRkEICAEGRkZGRkZGRkZGRkZBCAgBBkZGRkZEA8ZFRQUGQQgIAQZGRkYCh0dChkUFBkEICAEGRUZGQ0KCgwZFxYZBCAgBBkTHx8OAQEOHx8TGQQgIAQZGh4AAhkZGh0AAhkEIAQGCxofAAIZGRofAAILBQQECwgOGxwOGRkOHx8OCAsEIAQHCAsLGRkZGRIRCQcEICAgICAHBwMEBAMHByAgICAgICAgICAgICAgICAgICAggAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAACAAQAAgAEAAIABAAAAAAAAAAAAAIABAADwDwAA//8AAA=="> <style>.sf-hidden { display: none !important }</style> <link rel=canonical href=http://localhost:8080/pkg/rockfic.com/orm/> <meta http-equiv=content-security-policy content="default-src 'none'; font-src 'self' data:; img-src 'self' data:; style-src 'unsafe-inline'; media-src 'self' data:; script-src 'unsafe-inline' data:; object-src 'self' data:; frame-src 'self' data:;"> <style>img[src="data:,"], source[src="data:,"] { display: none !important }</style> </head> <body cz-shortcut-listen=true> <div id=lowframe style="position:fixed;bottom:0;left:0;height:0;width:100%;border-top:thin solid grey;background-color:white;overflow:auto"> ... </div> <div id=topbar class=wide> <div class=container> <div class=top-heading id=heading-wide><a href=http://localhost:8080/pkg/>Go Documentation Server</a></div> <div class="top-heading sf-hidden" id=heading-narrow></div> <a href=# id=menu-button class=sf-hidden></a> <form method=GET action=/search> <div id=menu style=min-width:60px> <span class=search-box><input type=search id=search name=q placeholder=Search aria-label=Search required value><button type=submit><span><svg width=24 height=24 viewBox="0 0 24 24"><title>submit search</title><path d="M15.5 14h-.79l-.28-.27C15.41 12.59 16 11.11 16 9.5 16 5.91 13.09 3 9.5 3S3 5.91 3 9.5 5.91 16 9.5 16c1.61 0 3.09-.59 4.23-1.57l.27.28v.79l5 4.99L20.49 19l-4.99-5zm-6 0C7.01 14 5 11.99 5 9.5S7.01 5 9.5 5 14 7.01 14 9.5 11.99 14 9.5 14z"></path><path d="M0 0h24v24H0z" fill=none></path></svg></span></button></span> </div> </form> </div> </div> <div id=page class=wide style=outline:0px tabindex=-1> <div class=container> <h1> Package orm <span class=text-muted></span> </h1> <div id=nav></div> <div id=short-nav> <dl> <dd><code>import "rockfic.com/orm"</code></dd> </dl> <dl> <dd><a href=#pkg-overview class=overviewLink>Overview</a></dd> <dd><a href=#pkg-index class=indexLink>Index</a></dd> <dd><a href=#pkg-subdirectories>Subdirectories</a></dd> </dl> </div> <div id=pkg-overview class=toggleVisible> <div class="collapsed sf-hidden"> </div> <div class=expanded> <h2 class=toggleButton title="Click to hide Overview section">Overview ▾</h2> </div> </div> <div id=pkg-index class=toggleVisible> <div class="collapsed sf-hidden"> </div> <div class=expanded> <h2 class=toggleButton title="Click to hide Index section">Index ▾</h2> <div id=manual-nav> <dl> <dd><a href=#pkg-constants>Constants</a></dd> <dd><a href=#pkg-variables>Variables</a></dd> <dd><a href=#Connect>func Connect(uri string, dbName string)</a></dd> <dd><a href=#Create>func Create(d any) any</a></dd> <dd><a href=#CreateSlice>func CreateSlice[T any](d T) []*T</a></dd> <dd><a href=#Counter>type Counter</a></dd> <dd><a href=#Document>type Document</a></dd> <dd> <a href=#Document.Append>func (d *Document) Append(field string, a ...interface{}) error</a></dd> <dd> <a href=#Document.Delete>func (d *Document) Delete() error</a></dd> <dd> <a href=#Document.Pull>func (d *Document) Pull(field string, a ...any) error</a></dd> <dd> <a href=#Document.Remove>func (d *Document) Remove() error</a></dd> <dd> <a href=#Document.Save>func (d *Document) Save() error</a></dd> <dd> <a href=#Document.Swap>func (d *Document) Swap(field string, i, j int) error</a></dd> <dd><a href=#DocumentSlice>type DocumentSlice</a></dd> <dd> <a href=#DocumentSlice.Delete>func (d *DocumentSlice) Delete() error</a></dd> <dd> <a href=#DocumentSlice.Remove>func (d *DocumentSlice) Remove() error</a></dd> <dd> <a href=#DocumentSlice.Save>func (d *DocumentSlice) Save() error</a></dd> <dd><a href=#GridFSFile>type GridFSFile</a></dd> <dd><a href=#HasID>type HasID</a></dd> <dd><a href=#HasIDSlice>type HasIDSlice</a></dd> <dd><a href=#IDocument>type IDocument</a></dd> <dd><a href=#IDocumentSlice>type IDocumentSlice</a></dd> <dd><a href=#IModel>type IModel</a></dd> <dd><a href=#InternalIndex>type InternalIndex</a></dd> <dd><a href=#Model>type Model</a></dd> <dd> <a href=#Model.Find>func (m *Model) Find(query interface{}, opts ...*options.FindOptions) (*Query, error)</a></dd> <dd> <a href=#Model.FindByID>func (m *Model) FindByID(id interface{}) (*Query, error)</a></dd> <dd> <a href=#Model.FindOne>func (m *Model) FindOne(query interface{}, options ...*options.FindOneOptions) (*Query, error)</a></dd> <dd> <a href=#Model.FindPaged>func (m *Model) FindPaged(query interface{}, page int64, perPage int64, opts ...*options.FindOptions) (*Query, error)</a></dd> <dd> <a href=#Model.FindRaw>func (m *Model) FindRaw(query interface{}, opts ...*options.FindOptions) (*mongo.Cursor, error)</a></dd> <dd><a href=#Query>type Query</a></dd> <dd> <a href=#Query.Exec>func (q *Query) Exec(result interface{})</a></dd> <dd> <a href=#Query.JSON>func (q *Query) JSON() (string, error)</a></dd> <dd> <a href=#Query.LoadFile>func (q *Query) LoadFile(fields ...string) *Query</a> </dd> <dd> <a href=#Query.Populate>func (q *Query) Populate(fields ...string) *Query</a> </dd> <dd><a href=#Reference>type Reference</a></dd> <dd><a href=#TModelRegistry>type TModelRegistry</a></dd> <dd> <a href=#TModelRegistry.Get>func (r TModelRegistry) Get(name string) *Model</a></dd> <dd> <a href=#TModelRegistry.Has>func (r TModelRegistry) Has(i interface{}) (string, *Model, bool)</a></dd> <dd> <a href=#TModelRegistry.HasByName>func (r TModelRegistry) HasByName(n string) (string, *Model, bool)</a></dd> <dd> <a href=#TModelRegistry.Index>func (r TModelRegistry) Index(n string) int</a> </dd> <dd> <a href=#TModelRegistry.Model>func (r TModelRegistry) Model(mdl ...any)</a> </dd> </dl> </div> <h3>Package files</h3> <p> <span style=font-size:90%> <a href=http://localhost:8080/src/rockfic.com/orm/document.go>document.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/document_internals.go>document_internals.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/document_slice.go>document_slice.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/errors.go>errors.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/gridfs.go>gridfs.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/idcounter.go>idcounter.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/indexes.go>indexes.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/model.go>model.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/query.go>query.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/registry.go>registry.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/testing.go>testing.go</a> <a href=http://localhost:8080/src/rockfic.com/orm/util.go>util.go</a> </span> </p> </div> </div> <h2 id=pkg-constants>Constants <a class="permalink sf-hidden" href=#pkg-constants>¶</a></h2> <pre>const ( <span id=OP_FIND_ONE>OP_FIND_ONE</span> = "findOne" <span id=OP_FIND_PAGED>OP_FIND_PAGED</span> = "findPaged" <span id=OP_FIND_ALL>OP_FIND_ALL</span> = "findAll" <span id=OP_FIND>OP_FIND</span> = "find" )</pre> <pre>const <span id=COUNTER_COL>COUNTER_COL</span> = "@counters"</pre> <h2 id=pkg-variables>Variables <a class="permalink sf-hidden" href=#pkg-variables>¶</a></h2> <pre>var ( <span id=ErrNotASlice>ErrNotASlice</span> = <a href=http://localhost:8080/pkg/errors/>errors</a>.<a href=http://localhost:8080/pkg/errors/#New>New</a>("Current object or field is not a slice!") <span id=ErrNotAStruct>ErrNotAStruct</span> = <a href=http://localhost:8080/pkg/errors/>errors</a>.<a href=http://localhost:8080/pkg/errors/#New>New</a>("Current object or field is not a struct!") <span id=ErrOutOfBounds>ErrOutOfBounds</span> = <a href=http://localhost:8080/pkg/errors/>errors</a>.<a href=http://localhost:8080/pkg/errors/#New>New</a>("Index(es) out of bounds!") <span id=ErrAppendMultipleDocuments>ErrAppendMultipleDocuments</span> = <a href=http://localhost:8080/pkg/errors/>errors</a>.<a href=http://localhost:8080/pkg/errors/#New>New</a>("Cannot append to multiple documents!") <span id=ErrNotSliceOrStruct>ErrNotSliceOrStruct</span> = <a href=http://localhost:8080/pkg/errors/>errors</a>.<a href=http://localhost:8080/pkg/errors/#New>New</a>("Current object or field is not a slice nor a struct!") <span id=ErrUnsupportedID>ErrUnsupportedID</span> = <a href=http://localhost:8080/pkg/errors/>errors</a>.<a href=http://localhost:8080/pkg/errors/#New>New</a>("Unknown or unsupported id type provided") )</pre> <p>DB - The mongodb database handle <pre>var <span id=DB>DB</span> *<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/>mongo</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/#Database>Database</a></pre> <p>DBClient - The mongodb client <pre>var <span id=DBClient>DBClient</span> *<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/>mongo</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/#Client>Client</a></pre> <p>ModelRegistry - the ModelRegistry stores a map containing pointers to Model instances, keyed by an associated model name <pre>var <span id=ModelRegistry>ModelRegistry</span> = <a href=http://localhost:8080/pkg/builtin/#make>make</a>(<a href=#TModelRegistry>TModelRegistry</a>)</pre> <p>NextStringID - Override this function with your own string ID generator! <pre>var <span id=NextStringID>NextStringID</span> func() <a href=http://localhost:8080/pkg/builtin/#string>string</a></pre> <h2 id=Connect>func <a href="http://localhost:8080/src/rockfic.com/orm/registry.go?s=8614:8653#L349">Connect</a> <a class="permalink sf-hidden" href=#Connect>¶</a> </h2> <pre>func Connect(uri <a href=http://localhost:8080/pkg/builtin/#string>string</a>, dbName <a href=http://localhost:8080/pkg/builtin/#string>string</a>)</pre> <h2 id=Create>func <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=5453:5475#L206">Create</a> <a class="permalink sf-hidden" href=#Create>¶</a> </h2> <pre>func Create(d <a href=http://localhost:8080/pkg/builtin/#any>any</a>) <a href=http://localhost:8080/pkg/builtin/#any>any</a></pre> <p>Create creates a new instance of a given Document type and returns a pointer to it. <h2 id=CreateSlice>func <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=5819:5852#L221">CreateSlice</a> <a class="permalink sf-hidden" href=#CreateSlice>¶</a> </h2> <pre>func CreateSlice[T <a href=http://localhost:8080/pkg/builtin/#any>any</a>](d T) []*T</pre> <p>CreateSlice - convenience method which creates a new slice of type *T (where T is a type which embeds Document) and returns it <h2 id=Counter>type <a href="http://localhost:8080/src/rockfic.com/orm/idcounter.go?s=208:306#L4">Counter</a> <a class="permalink sf-hidden" href=#Counter>¶</a> </h2> <pre>type Counter struct { <span id=Counter.Current></span> Current <a href=http://localhost:8080/pkg/builtin/#any>any</a> `bson:"current"` <span id=Counter.Collection></span> Collection <a href=http://localhost:8080/pkg/builtin/#string>string</a> `bson:"collection"` } </pre> <h2 id=Document>type <a href="http://localhost:8080/src/rockfic.com/orm/document.go?s=44:343#L1">Document</a> <a class="permalink sf-hidden" href=#Document>¶</a> </h2> <pre>type Document struct { <span id=Document.Created></span> <span class=comment>// Created time. updated/added automatically.</span> Created <a href=http://localhost:8080/pkg/time/>time</a>.<a href=http://localhost:8080/pkg/time/#Time>Time</a> `bson:"createdAt" json:"createdAt"` <span id=Document.Modified></span> <span class=comment>// Modified time. updated/added automatically.</span> Modified <a href=http://localhost:8080/pkg/time/>time</a>.<a href=http://localhost:8080/pkg/time/#Time>Time</a> `bson:"updatedAt" json:"updatedAt"` <span class=comment>// contains filtered or unexported fields</span> } </pre> <h3 id=Document.Append>func (*Document) <a href="http://localhost:8080/src/rockfic.com/orm/document.go?s=2453:2516#L107">Append</a> <a class="permalink sf-hidden" href=#Document.Append>¶</a> </h3> <pre>func (d *<a href=#Document>Document</a>) Append(field <a href=http://localhost:8080/pkg/builtin/#string>string</a>, a ...interface{}) <a href=http://localhost:8080/pkg/builtin/#error>error</a></pre> <p>Append appends one or more items to `field`. will error if this Model contains a reference to multiple documents, or if `field` is not a slice. <h3 id=Document.Delete>func (*Document) <a href="http://localhost:8080/src/rockfic.com/orm/document.go?s=1407:1440#L61">Delete</a> <a class="permalink sf-hidden" href=#Document.Delete>¶</a> </h3> <pre>func (d *<a href=#Document>Document</a>) Delete() <a href=http://localhost:8080/pkg/builtin/#error>error</a></pre> <p>Delete - deletes a model instance from the database <h3 id=Document.Pull>func (*Document) <a href="http://localhost:8080/src/rockfic.com/orm/document.go?s=3237:3290#L141">Pull</a> <a class="permalink sf-hidden" href=#Document.Pull>¶</a> </h3> <pre>func (d *<a href=#Document>Document</a>) Pull(field <a href=http://localhost:8080/pkg/builtin/#string>string</a>, a ...<a href=http://localhost:8080/pkg/builtin/#any>any</a>) <a href=http://localhost:8080/pkg/builtin/#error>error</a></pre> <p>Pull - removes elements from the subdocument slice stored in `field`. <h3 id=Document.Remove>func (*Document) <a href="http://localhost:8080/src/rockfic.com/orm/document.go?s=1740:1773#L78">Remove</a> <a class="permalink sf-hidden" href=#Document.Remove>¶</a> </h3> <pre>func (d *<a href=#Document>Document</a>) Remove() <a href=http://localhost:8080/pkg/builtin/#error>error</a></pre> <p>Remove - alias for Delete <h3 id=Document.Save>func (*Document) <a href="http://localhost:8080/src/rockfic.com/orm/document.go?s=1881:1912#L84">Save</a> <a class="permalink sf-hidden" href=#Document.Save>¶</a> </h3> <pre>func (d *<a href=#Document>Document</a>) Save() <a href=http://localhost:8080/pkg/builtin/#error>error</a></pre> <p>Save - updates this Model in the database, or inserts it if it doesn't exist <h3 id=Document.Swap>func (*Document) <a href="http://localhost:8080/src/rockfic.com/orm/document.go?s=4071:4124#L179">Swap</a> <a class="permalink sf-hidden" href=#Document.Swap>¶</a> </h3> <pre>func (d *<a href=#Document>Document</a>) Swap(field <a href=http://localhost:8080/pkg/builtin/#string>string</a>, i, j <a href=http://localhost:8080/pkg/builtin/#int>int</a>) <a href=http://localhost:8080/pkg/builtin/#error>error</a></pre> <p>Swap - swaps the elements at indexes `i` and `j` in the slice stored at `field` <h2 id=DocumentSlice>type <a href="http://localhost:8080/src/rockfic.com/orm/document_slice.go?s=132:162#L1">DocumentSlice</a> <a class="permalink sf-hidden" href=#DocumentSlice>¶</a> </h2> <pre>type DocumentSlice []<a href=#IDocument>IDocument</a></pre> <h3 id=DocumentSlice.Delete>func (*DocumentSlice) <a href="http://localhost:8080/src/rockfic.com/orm/document_slice.go?s=164:202#L3">Delete</a> <a class="permalink sf-hidden" href=#DocumentSlice.Delete>¶</a> </h3> <pre>func (d *<a href=#DocumentSlice>DocumentSlice</a>) Delete() <a href=http://localhost:8080/pkg/builtin/#error>error</a></pre> <h3 id=DocumentSlice.Remove>func (*DocumentSlice) <a href="http://localhost:8080/src/rockfic.com/orm/document_slice.go?s=321:359#L14">Remove</a> <a class="permalink sf-hidden" href=#DocumentSlice.Remove>¶</a> </h3> <pre>func (d *<a href=#DocumentSlice>DocumentSlice</a>) Remove() <a href=http://localhost:8080/pkg/builtin/#error>error</a></pre> <h3 id=DocumentSlice.Save>func (*DocumentSlice) <a href="http://localhost:8080/src/rockfic.com/orm/document_slice.go?s=384:420#L18">Save</a> <a class="permalink sf-hidden" href=#DocumentSlice.Save>¶</a> </h3> <pre>func (d *<a href=#DocumentSlice>DocumentSlice</a>) Save() <a href=http://localhost:8080/pkg/builtin/#error>error</a></pre> <h2 id=GridFSFile>type <a href="http://localhost:8080/src/rockfic.com/orm/gridfs.go?s=345:499#L10">GridFSFile</a> <a class="permalink sf-hidden" href=#GridFSFile>¶</a> </h2> <pre>type GridFSFile struct { <span id=GridFSFile.ID></span> ID <a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/bson/primitive/>primitive</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/bson/primitive/#ObjectID>ObjectID</a> `bson:"_id"` <span id=GridFSFile.Name></span> Name <a href=http://localhost:8080/pkg/builtin/#string>string</a> `bson:"filename"` <span id=GridFSFile.Length></span> Length <a href=http://localhost:8080/pkg/builtin/#int>int</a> `bson:"length"` } </pre> <h2 id=HasID>type <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=792:841#L21">HasID</a> <a class="permalink sf-hidden" href=#HasID>¶</a> </h2> <p>HasID is a simple interface that you must implement in your models, using a pointer receiver. This allows for more flexibility in cases where your ID isn't an ObjectID (e.g., int, uint, string...). <p>and yes, those darn ugly ObjectIDs are supported :) <pre>type HasID interface { Id() <a href=http://localhost:8080/pkg/builtin/#any>any</a> SetId(id <a href=http://localhost:8080/pkg/builtin/#any>any</a>) }</pre> <h2 id=HasIDSlice>type <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=843:866#L26">HasIDSlice</a> <a class="permalink sf-hidden" href=#HasIDSlice>¶</a> </h2> <pre>type HasIDSlice []<a href=#HasID>HasID</a></pre> <h2 id=IDocument>type <a href="http://localhost:8080/src/rockfic.com/orm/document.go?s=344:775#L7">IDocument</a> <a class="permalink sf-hidden" href=#IDocument>¶</a> </h2> <pre>type IDocument interface { Append(field <a href=http://localhost:8080/pkg/builtin/#string>string</a>, a ...interface{}) <a href=http://localhost:8080/pkg/builtin/#error>error</a> Pull(field <a href=http://localhost:8080/pkg/builtin/#string>string</a>, a ...<a href=http://localhost:8080/pkg/builtin/#any>any</a>) <a href=http://localhost:8080/pkg/builtin/#error>error</a> Swap(field <a href=http://localhost:8080/pkg/builtin/#string>string</a>, i, j <a href=http://localhost:8080/pkg/builtin/#int>int</a>) <a href=http://localhost:8080/pkg/builtin/#error>error</a> Delete() <a href=http://localhost:8080/pkg/builtin/#error>error</a> Remove() <a href=http://localhost:8080/pkg/builtin/#error>error</a> Save() <a href=http://localhost:8080/pkg/builtin/#error>error</a> <span class=comment>// contains filtered or unexported methods</span> }</pre> <h2 id=IDocumentSlice>type <a href="http://localhost:8080/src/rockfic.com/orm/document_slice.go?s=13:130#L1">IDocumentSlice</a> <a class="permalink sf-hidden" href=#IDocumentSlice>¶</a> </h2> <pre>type IDocumentSlice interface { Delete() <a href=http://localhost:8080/pkg/builtin/#error>error</a> Remove() <a href=http://localhost:8080/pkg/builtin/#error>error</a> Save() <a href=http://localhost:8080/pkg/builtin/#error>error</a> <span class=comment>// contains filtered or unexported methods</span> }</pre> <h2 id=IModel>type <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=868:1425#L28">IModel</a> <a class="permalink sf-hidden" href=#IModel>¶</a> </h2> <pre>type IModel interface { FindRaw(query interface{}, opts ...*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/>options</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/#FindOptions>FindOptions</a>) (*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/>mongo</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/#Cursor>Cursor</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>) Find(query interface{}, opts ...*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/>options</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/#FindOptions>FindOptions</a>) (*<a href=#Query>Query</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>) FindByID(id interface{}) (*<a href=#Query>Query</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>) FindOne(query interface{}, options ...*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/>options</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/#FindOneOptions>FindOneOptions</a>) (*<a href=#Query>Query</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>) FindPaged(query interface{}, page <a href=http://localhost:8080/pkg/builtin/#int64>int64</a>, perPage <a href=http://localhost:8080/pkg/builtin/#int64>int64</a>, options ...*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/>options</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/#FindOptions>FindOptions</a>) (*<a href=#Query>Query</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>) <span class=comment>// contains filtered or unexported methods</span> }</pre> <h2 id=InternalIndex>type <a href="http://localhost:8080/src/rockfic.com/orm/indexes.go?s=248:360#L5">InternalIndex</a> <a class="permalink sf-hidden" href=#InternalIndex>¶</a> </h2> <p>prolly won't need to use indexes, but just in case... <pre>type InternalIndex struct { <span id=InternalIndex.Fields></span> Fields []<a href=http://localhost:8080/pkg/builtin/#string>string</a> <span id=InternalIndex.Options></span> Options []<a href=http://localhost:8080/pkg/builtin/#string>string</a> <span class=comment>// contains filtered or unexported fields</span> } </pre> <h2 id=Model>type <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=258:522#L5">Model</a> <a class="permalink sf-hidden" href=#Model>¶</a> </h2> <p>Model - type which contains "static" methods like Find, FindOne, etc. <pre>type Model struct { <span id=Model.Indexes></span> Indexes map[<a href=http://localhost:8080/pkg/builtin/#string>string</a>][]<a href=#InternalIndex>InternalIndex</a> <span id=Model.Type></span> Type <a href=http://localhost:8080/pkg/reflect/>reflect</a>.<a href=http://localhost:8080/pkg/reflect/#Type>Type</a> <span class=comment>// contains filtered or unexported fields</span> } </pre> <h3 id=Model.Find>func (*Model) <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=2599:2684#L88">Find</a> <a class="permalink sf-hidden" href=#Model.Find>¶</a> </h3> <pre>func (m *<a href=#Model>Model</a>) Find(query interface{}, opts ...*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/>options</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/#FindOptions>FindOptions</a>) (*<a href=#Query>Query</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>)</pre> <p>Find - find all documents satisfying `query`. returns a pointer to a Query for further chaining. <h3 id=Model.FindByID>func (*Model) <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=3994:4050#L137">FindByID</a> <a class="permalink sf-hidden" href=#Model.FindByID>¶</a> </h3> <pre>func (m *<a href=#Model>Model</a>) FindByID(id interface{}) (*<a href=#Query>Query</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>)</pre> <p>FindByID - find a single document by its _id field. Wrapper around FindOne with an ID query as its first argument <h3 id=Model.FindOne>func (*Model) <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=4205:4299#L143">FindOne</a> <a class="permalink sf-hidden" href=#Model.FindOne>¶</a> </h3> <pre>func (m *<a href=#Model>Model</a>) FindOne(query interface{}, options ...*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/>options</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/#FindOneOptions>FindOneOptions</a>) (*<a href=#Query>Query</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>)</pre> <p>FindOne - find a single document satisfying `query`. returns a pointer to a Query for further chaining. <h3 id=Model.FindPaged>func (*Model) <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=3461:3578#L120">FindPaged</a> <a class="permalink sf-hidden" href=#Model.FindPaged>¶</a> </h3> <pre>func (m *<a href=#Model>Model</a>) FindPaged(query interface{}, page <a href=http://localhost:8080/pkg/builtin/#int64>int64</a>, perPage <a href=http://localhost:8080/pkg/builtin/#int64>int64</a>, opts ...*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/>options</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/#FindOptions>FindOptions</a>) (*<a href=#Query>Query</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>)</pre> <p>FindPaged - Wrapper around FindAll with the Skip and Limit options populated. returns a pointer to a Query for further chaining. <h3 id=Model.FindRaw>func (*Model) <a href="http://localhost:8080/src/rockfic.com/orm/model.go?s=2296:2391#L80">FindRaw</a> <a class="permalink sf-hidden" href=#Model.FindRaw>¶</a> </h3> <pre>func (m *<a href=#Model>Model</a>) FindRaw(query interface{}, opts ...*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/>options</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/options/#FindOptions>FindOptions</a>) (*<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/>mongo</a>.<a href=http://localhost:8080/pkg/go.mongodb.org/mongo-driver/mongo/#Cursor>Cursor</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>)</pre> <p>FindRaw - find documents satisfying `query` and return a plain mongo cursor. <h2 id=Query>type <a href="http://localhost:8080/src/rockfic.com/orm/query.go?s=246:384#L7">Query</a> <a class="permalink sf-hidden" href=#Query>¶</a> </h2> <pre>type Query struct { <span class=comment>// contains filtered or unexported fields</span> } </pre> <h3 id=Query.Exec>func (*Query) <a href="http://localhost:8080/src/rockfic.com/orm/query.go?s=11608:11648#L491">Exec</a> <a class="permalink sf-hidden" href=#Query.Exec>¶</a> </h3> <pre>func (q *<a href=#Query>Query</a>) Exec(result interface{})</pre> <p>Exec - executes the query and puts its results into the provided argument. <p>Will panic if called more than once on the same Query instance. <h3 id=Query.JSON>func (*Query) <a href="http://localhost:8080/src/rockfic.com/orm/query.go?s=11299:11337#L479">JSON</a> <a class="permalink sf-hidden" href=#Query.JSON>¶</a> </h3> <pre>func (q *<a href=#Query>Query</a>) JSON() (<a href=http://localhost:8080/pkg/builtin/#string>string</a>, <a href=http://localhost:8080/pkg/builtin/#error>error</a>)</pre> <p>JSON - marshals this Query's results into json format <h3 id=Query.LoadFile>func (*Query) <a href="http://localhost:8080/src/rockfic.com/orm/query.go?s=4479:4528#L188">LoadFile</a> <a class="permalink sf-hidden" href=#Query.LoadFile>¶</a> </h3> <pre>func (q *<a href=#Query>Query</a>) LoadFile(fields ...<a href=http://localhost:8080/pkg/builtin/#string>string</a>) *<a href=#Query>Query</a></pre> <p>LoadFile - loads the contents of one or more files stored in gridFS into the fields named by `fields`. <p>gridFS fields can be either a `string` or `[]byte`, and are tagged with `gridfs:"BUCKET,FILE_FORMAT` where: <ul> <li>`BUCKET` is the name of the bucket where the files are stored <li>`FILE_FORMAT` is any valid go template string that resolves to the unique file name. all exported values and methods present in the surrounding struct can be used in this template. </ul> <h3 id=Query.Populate>func (*Query) <a href="http://localhost:8080/src/rockfic.com/orm/query.go?s=4968:5017#L210">Populate</a> <a class="permalink sf-hidden" href=#Query.Populate>¶</a> </h3> <pre>func (q *<a href=#Query>Query</a>) Populate(fields ...<a href=http://localhost:8080/pkg/builtin/#string>string</a>) *<a href=#Query>Query</a></pre> <p>Populate populates document references via reflection <h2 id=Reference>type <a href="http://localhost:8080/src/rockfic.com/orm/registry.go?s=348:640#L9">Reference</a> <a class="permalink sf-hidden" href=#Reference>¶</a> </h2> <p>Reference stores a typed document reference <pre>type Reference struct { <span class=comment>// owning model name</span> <span id=Reference.Model></span> Model <a href=http://localhost:8080/pkg/builtin/#string>string</a> <span class=comment>// the name of the struct field</span> <span id=Reference.FieldName></span> FieldName <a href=http://localhost:8080/pkg/builtin/#string>string</a> <span class=comment>// index of field in owning struct</span> <span id=Reference.Idx></span> Idx <a href=http://localhost:8080/pkg/builtin/#int>int</a> <span class=comment>// the type of the referenced object</span> <span id=Reference.HydratedType></span> HydratedType <a href=http://localhost:8080/pkg/reflect/>reflect</a>.<a href=http://localhost:8080/pkg/reflect/#Type>Type</a> <span class=comment>// field kind (struct, slice, ...)</span> <span id=Reference.Kind></span> Kind <a href=http://localhost:8080/pkg/reflect/>reflect</a>.<a href=http://localhost:8080/pkg/reflect/#Kind>Kind</a> <span class=comment>// contains filtered or unexported fields</span> } </pre> <h2 id=TModelRegistry>type <a href="http://localhost:8080/src/rockfic.com/orm/registry.go?s=758:795#L32">TModelRegistry</a> <a class="permalink sf-hidden" href=#TModelRegistry>¶</a> </h2> <pre>type TModelRegistry map[<a href=http://localhost:8080/pkg/builtin/#string>string</a>]*<a href=#Model>Model</a></pre> <h3 id=TModelRegistry.Get>func (TModelRegistry) <a href="http://localhost:8080/src/rockfic.com/orm/registry.go?s=5521:5568#L227">Get</a> <a class="permalink sf-hidden" href=#TModelRegistry.Get>¶</a> </h3> <pre>func (r <a href=#TModelRegistry>TModelRegistry</a>) Get(name <a href=http://localhost:8080/pkg/builtin/#string>string</a>) *<a href=#Model>Model</a></pre> <h3 id=TModelRegistry.Has>func (TModelRegistry) <a href="http://localhost:8080/src/rockfic.com/orm/registry.go?s=4455:4520#L183">Has</a> <a class="permalink sf-hidden" href=#TModelRegistry.Has>¶</a> </h3> <pre>func (r <a href=#TModelRegistry>TModelRegistry</a>) Has(i interface{}) (<a href=http://localhost:8080/pkg/builtin/#string>string</a>, *<a href=#Model>Model</a>, <a href=http://localhost:8080/pkg/builtin/#bool>bool</a>)</pre> <p>Has returns the model typename and Model instance corresponding to the argument passed, as well as a boolean indicating whether it was found. otherwise returns `"", nil, false` <h3 id=TModelRegistry.HasByName>func (TModelRegistry) <a href="http://localhost:8080/src/rockfic.com/orm/registry.go?s=4797:4863#L197">HasByName</a> <a class="permalink sf-hidden" href=#TModelRegistry.HasByName>¶</a> </h3> <pre>func (r <a href=#TModelRegistry>TModelRegistry</a>) HasByName(n <a href=http://localhost:8080/pkg/builtin/#string>string</a>) (<a href=http://localhost:8080/pkg/builtin/#string>string</a>, *<a href=#Model>Model</a>, <a href=http://localhost:8080/pkg/builtin/#bool>bool</a>)</pre> <p>HasByName functions almost identically to Has, except that it takes a string as its argument. <h3 id=TModelRegistry.Index>func (TModelRegistry) <a href="http://localhost:8080/src/rockfic.com/orm/registry.go?s=5019:5062#L205">Index</a> <a class="permalink sf-hidden" href=#TModelRegistry.Index>¶</a> </h3> <pre>func (r <a href=#TModelRegistry>TModelRegistry</a>) Index(n <a href=http://localhost:8080/pkg/builtin/#string>string</a>) <a href=http://localhost:8080/pkg/builtin/#int>int</a></pre> <p>Index returns the index at which the Document struct is embedded <h3 id=TModelRegistry.Model>func (TModelRegistry) <a href="http://localhost:8080/src/rockfic.com/orm/registry.go?s=5740:5781#L237">Model</a> <a class="permalink sf-hidden" href=#TModelRegistry.Model>¶</a> </h3> <pre>func (r <a href=#TModelRegistry>TModelRegistry</a>) Model(mdl ...<a href=http://localhost:8080/pkg/builtin/#any>any</a>)</pre> <p>Model registers models in the ModelRegistry, where they can be accessed via a model's struct name <h2 id=pkg-subdirectories>Subdirectories <a class="permalink sf-hidden" href=#pkg-subdirectories>¶</a></h2> <div class=pkg-dir> <table> <tbody> <tr> <th class=pkg-name>Name</th> <th class=pkg-synopsis>Synopsis</th> </tr> <tr> <td colspan=2><a href=http://localhost:8080/pkg/rockfic.com/>..</a></td> </tr> <tr> <td class=pkg-name style=padding-left:0px> <a href=http://localhost:8080/pkg/rockfic.com/orm/muck/>muck</a> </td> <td class=pkg-synopsis> You can edit this code! Click here and start typing. </td> </tr> </table> </div> <div id=footer> Build version go1.23.0.<br> Except as <a href=https://developers.google.com/site-policies#restrictions>noted</a>, the content of this page is licensed under the Creative Commons Attribution 3.0 License, and code is licensed under a <a href=http://localhost:8080/LICENSE>BSD license</a>.<br> <a href=https://golang.org/doc/tos.html>Terms of Service</a> | <a href=https://www.google.com/intl/en/policies/privacy/>Privacy Policy</a> </div> </div> </div>