good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
U
upper
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
open
upper
Commits
bd9912d3
Commit
bd9912d3
authored
11 years ago
by
Carlos Nieto
Browse files
Options
Downloads
Patches
Plain Diff
Grammar fixes.
parent
bb402f24
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
README.md
+16
-9
16 additions, 9 deletions
README.md
with
16 additions
and
9 deletions
README.md
+
16
−
9
View file @
bd9912d3
...
...
@@ -43,7 +43,7 @@ type Birthday struct {
}
```
### Open a database session
### Open
ning
a database session
Define your database settings using the
`db.Settings`
struct.
...
...
@@ -59,7 +59,7 @@ Open a connection to a database using a driver (`sqlite` in this example).
sess
,
err
=
db
.
Open
(
"sqlite"
,
settings
)
```
### Us
e
a table/collection
### Us
ing
a table/collection
Get a collection reference.
...
...
@@ -67,7 +67,7 @@ Get a collection reference.
birthdayCollection
,
err
=
sess
.
Collection
(
"birthdays"
)
```
###
Insert
a new item
###
Adding
a new item
Use the
`Collection.Append`
method in the collection reference to save a new
item.
...
...
@@ -79,7 +79,7 @@ id, err = birthdayCollection.Append(Birthday{
})
```
### Search for items
### Search
ing
for items
Use the
`Collection.Find`
method to search for the recently appended item and
create a result set.
...
...
@@ -88,7 +88,7 @@ create a result set.
res = birthdayCollection.Find(db.Cond{"id": id})
```
### Fetch an item
### Fetch
ing
an item
Use the
`Result.One`
method from the result set to fetch just one result and
populate an empty struct of the same type.
...
...
@@ -98,7 +98,7 @@ var birthday Birthday
err
=
res
.
One
(
&
birthday
)
```
### Updat
e
an item
### Updat
ing
an item
Modify the struct and commit the update to all the items within the result set
(just one in this example) to permanent storage.
...
...
@@ -108,7 +108,7 @@ birthday.Name = `Miyazaki Hayao`
err
=
res
.
Update
(
birthday
)
```
### Remov
e
an iem
### Remov
ing
an i
t
em
Remove all the items within the result set (just one in this example).
...
...
@@ -116,8 +116,15 @@ Remove all the items within the result set (just one in this example).
err
=
res
.
Remove
()
```
Close this session, you can also use
`defer`
after a successful
`Database.Open`
for closing.
### Closing a result set
```
go
res
.
Close
()
```
### Ending session
You can also use
`defer`
after a successful
`Database.Open`
for closing a
database session.
```
go
sess
.
Close
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment