Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
6
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
F
fsharp-sql-provider
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Iterations
Merge Requests
1
Merge Requests
1
Requirements
Requirements
List
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Test Cases
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Package Registry
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issue
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Sean
fsharp-sql-provider
Commits
0aea4ffd
Commit
0aea4ffd
authored
Feb 08, 2020
by
Sean
🎨
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix compiler errors from schema
parent
62175ea2
Pipeline
#116234606
passed with stage
in 1 minute and 6 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
18 additions
and
11 deletions
+18
-11
Cli.fs
Cli.fs
+3
-1
DbAccess.fs
DbAccess.fs
+2
-2
Domain.fs
Domain.fs
+3
-1
Helpers.fs
Helpers.fs
+3
-0
Loader.fs
Loader.fs
+7
-7
No files found.
Cli.fs
View file @
0aea4ffd
...
...
@@ -22,10 +22,12 @@ let private handleAdd() =
|
"cat"
->
printf
" > What's the kitty's name? > "
let
name
=
getInput
()
printf
" > How old is the kitty's name? > "
let
age
=
getInput
()
|>
int
printf
" > What's the kitty's breed? > "
let
breed
=
getInput
()
let
newCat
=
mkCat
name
breed
|>
insertCat
let
newCat
=
mkCat
name
age
breed
|>
insertCat
catToStr
newCat
|>
printfn
" > There's a new cat on the block: %s"
|
"b"
...
...
DbAccess.fs
View file @
0aea4ffd
...
...
@@ -49,7 +49,7 @@ let private OwnerCats = catDb.OwnerCats
// creating entity functions - basic building blocks for CRUD functions
let
private
createBreed
=
Breeds
.
``Create(name)``
let
private
createAttribute
=
Attributes
.
``Create(description, name)``
let
private
createCat
=
Cats
.
``Create(breedid, name)``
let
private
createCat
=
Cats
.
``Create(
age,
breedid, name)``
let
private
createOwner
=
Owners
.
``Create(age, name)``
let
private
createBreedAttr
=
BreedAttrs
.
``Create(attributeid, breedid)``
let
private
createOwnerCat
=
Owners
.
``Create(age, name)``
...
...
@@ -79,7 +79,7 @@ let private defInsertBreed: string -> unit -> int = thunkOne insertBreed
let
insertCat
cat
=
let
breedId
=
findBreedIdByName
cat
.
breed
.
name
|>
Option
.
defaultWith
(
defInsertBreed
cat
.
breed
.
name
)
let
catEntity
=
createCat
(
breedId
,
cat
.
name
)
let
catEntity
=
createCat
(
cat
.
age
,
breedId
,
cat
.
name
)
printfn
" > Makin' kitteh %s"
cat
.
name
ctx
.
SubmitUpdates
()
printfn
" > ✅"
...
...
Domain.fs
View file @
0aea4ffd
...
...
@@ -10,11 +10,13 @@ type Breed =
type
Cat
=
{
id
:
int
option
name
:
string
age
:
int
breed
:
Breed
}
/// Make a cat with just a name and breed name, with None for ids
let
mkCat
catName
breedName
=
let
mkCat
catName
age
breedName
=
{
id
=
None
age
=
age
name
=
catName
breed
=
{
id
=
None
...
...
Helpers.fs
View file @
0aea4ffd
...
...
@@ -7,6 +7,9 @@ module Helpers
/// Take a function, and a tuple, and call the function with the destructured tuple
let
withTuple
f
(
a
,
b
)
=
f
a
b
/// Take a func, and a triple, and call the func with the destructured tuple
let
withTriple
f
(
a
,
b
,
c
)
=
f
a
b
c
/// Take anything, and give back a zero - a success exit code
let
returnZero
_
=
0
...
...
Loader.fs
View file @
0aea4ffd
...
...
@@ -10,17 +10,17 @@ module DB = DbAccess
/// Take a tuple and make a cat in the db, then turn it into a string
let
private
tupleToCatStr
=
withT
u
ple
mkCat
withT
ri
ple
mkCat
>>
DB
.
insertCat
>>
catToStr
let
private
rawCatData
=
[
(
"Denton"
,
"Gray Tabby"
)
(
"Mitzie"
,
"Tuxedo"
)
(
"Saphire"
,
"Blue Russian"
)
(
"Ailee"
,
"Siamese"
)
(
"Oreo"
,
"Tuxedo"
)
(
"Frisky"
,
"Tuxedo"
)
]
[
(
"Denton"
,
2
,
"Gray Tabby"
)
(
"Mitzie"
,
6
,
"Tuxedo"
)
(
"Saphire"
,
1
,
"Blue Russian"
)
(
"Ailee"
,
2
,
"Siamese"
)
(
"Oreo"
,
6
,
"Tuxedo"
)
(
"Frisky"
,
15
,
"Tuxedo"
)
]
/// Loads a set of data into the db
let
load
()
=
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment