This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct CustomRawMigration: AsyncMigration { | |
func prepare(on database: Database) async throws { | |
try await (database as! SQLDatabase) | |
.raw("ALTER TABLE `table_name` MODIFY `field_name` ENUM('case1', 'case2', 'case3') DEFAULT 'case1'") | |
.run() | |
} | |
func revert(on database: Database) async throws { | |
try await (database as! SQLDatabase) | |
.raw("ALTER TABLE `table_name` MODIFY `field_name` ENUM('case1', 'case2') DEFAULT 'case1'") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
###### CONFIG ###### | |
# Here is a link | |
$link = <<<EOF | |
https://www.google.com/ | |
EOF; | |
# And some text to copy |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Fluent | |
import SQLKit | |
struct CreateVersionsCreatedAtIndex: AsyncMigration { | |
func prepare(on database: Database) async throws { | |
try await (database as! SQLDatabase) | |
.create(index: "versions_created_at_index") // Index name | |
.on("versions") // Table name | |
.column("created_at") | |
// You can also add more columns here if you want a multi-column index... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
#if canImport(FoundationNetworking) | |
import FoundationNetworking | |
#endif | |
/// Defines the possible errors | |
public enum URLSessionAsyncErrors: Error { | |
case invalidUrlResponse, missingResponseData | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SwiftUI | |
/// Extend Image with named assets | |
extension Image { | |
enum Assets: String, RawRepresentable { | |
case appButtonImage | |
/// Place all your color assets here...the enum case should equal to the name you use in your Asset library | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We can get the Color for SwiftUI like so... | |
let color = Color(asset: .appTextColor) | |
// ...or a UIColor (which, unlike UIColor(named:) will be non-optional)... | |
let uiColor = UIColor(asset: .appTextColor) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
import SwiftUI | |
/// Extend Color to support named assets | |
extension Color { | |
enum Assets: String, RawRepresentable { | |
case appTextColor | |
/// Place all your color assets here...the enum case should equal to the name you use in your Asset library | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You can run prism in dynamic mode | |
prism mock -d ~/path/to/your/openapi.yaml | |
# Or you can force dynamic mode when you call a request | |
curl -v "http://127.0.0.1/endpoint?__dynamic=true" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pet: | |
type: object | |
properties: | |
id: | |
type: integer | |
format: int64 | |
name: | |
type: string | |
x-faker: name.firstName | |
example: doggie |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
image: node:latest | |
pages: | |
stage: deploy | |
script: | |
- npm install -g redoc-cli | |
- redoc-cli bundle -o public/index.html documentation/openapi.yaml | |
artifacts: | |
paths: | |
- public |
NewerOlder